/* ===================================
   Modern UI Stylesheet for TCXC
   ===================================
   This stylesheet contains modern UI improvements
   for forms, modals, and interactive elements
   =================================== */

/* ===================================
   Common Elements
   =================================== */

/* Container Layouts */
.edit-form-container,
.topup-container,
.message-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* Card/Section Styling */
.form-section,
.message-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-section {
  padding: 35px 40px;
}

.message-card {
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
  padding: 0;
  animation: slideIn 0.3s ease-out;
}

/* Section Headers */
.section-title {
  font-size: 18px;
  color: #333;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #a3c83a;
  font-weight: 600;
}

/* ===================================
   Form Elements
   =================================== */

/* Form Grid Layout */
.form-grid {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 15px;
  align-items: center;
}

.form-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  margin-bottom: 25px;
  align-items: center;
}

/* Form Labels */
.form-label {
  color: #555;
  font-weight: 500;
  font-size: 14px;
  text-align: right;
  padding-right: 15px;
}

.form-label-modal {
  color: #333;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
}

.form-label-required::after {
  content: " *";
  color: #dc3545;
}

/* Form Inputs */
.form-input,
.form-input-modal {
  padding: 10px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
  width: 100%;
  max-width: 350px;
}

.form-input-modal {
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
}

.form-input:focus,
.form-input-modal:focus {
  outline: none;
  border-color: #a3c83a;
  box-shadow: 0 0 0 2px rgba(163, 200, 58, 0.1);
}

.form-input-modal:focus {
  background: white;
  box-shadow: 0 0 0 3px rgba(163, 200, 58, 0.1);
}

.form-input-small {
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
  width: 120px;
}

.form-input-small:focus {
  outline: none;
  border-color: #a3c83a;
  box-shadow: 0 0 0 2px rgba(163, 200, 58, 0.1);
}

/* Form Select */
.form-select {
  padding: 10px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
  width: 100%;
  max-width: 400px;
  background: white;
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: menulist;
  -moz-appearance: menulist;
  color: #333;
  background-color: white;
}

.form-select:focus {
  outline: none;
  border-color: #a3c83a;
  box-shadow: 0 0 0 2px rgba(163, 200, 58, 0.1);
}

.form-select option {
  padding: 8px;
  color: #333;
  background: white;
}

/* Form Textarea */
.form-textarea,
.form-textarea-modal {
  padding: 10px 14px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s;
  width: 100%;
  min-height: 100px;
  resize: vertical;
}

.form-textarea-modal {
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  min-height: 120px;
  background: #f8f9fa;
}

.form-textarea:focus,
.form-textarea-modal:focus {
  outline: none;
  border-color: #a3c83a;
  box-shadow: 0 0 0 2px rgba(163, 200, 58, 0.1);
}

.form-textarea-modal:focus {
  background: white;
  box-shadow: 0 0 0 3px rgba(163, 200, 58, 0.1);
}

/* Form Checkbox */
.form-checkbox-container {
  display: flex;
  align-items: center;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Form Groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===================================
   Alert Messages
   =================================== */

.alert-message {
  padding: 15px 20px;
  border-radius: 6px;
  margin-bottom: 25px;
  font-size: 14px;
  animation: slideDown 0.3s ease-out;
}

.alert-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.alert-error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.alert-info {
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

.alert-warning {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
}

/* ===================================
   Navigation Bar Improvements
   =================================== */

.header2 {
  background: white !important;
  border-bottom: 1px solid #e9ecef !important;
  padding: 0 !important;
}

.header2 table {
  padding: 15px 0 !important;
}

.topnav {
  font-size: 14px !important;
}

.topnav a {
  color: #374151 !important;
  text-decoration: none !important;
  transition: color 0.2s;
}

.topnav a:hover {
  color: #a3c83a !important;
  text-decoration: none !important;
}

.topnav2 {
  background-color: #f8f9fa !important;
  border-bottom: 1px solid #e9ecef !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  margin-bottom: 2rem !important;
}

.topnav2 ul.nav {
  max-width: 1140px !important;
  padding: 0 !important;
}

.topnav2 ul.nav li.nav-item > a {
  font-size: 13px !important;
  color: #4b5563 !important;
  padding: 14px 20px !important;
  font-weight: 500 !important;
  letter-spacing: -0.2px !important;
  transition: all 0.2s !important;
  position: relative;
}

.topnav2 ul.nav li.nav-item > a:hover {
  color: #a3c83a !important;
  background: rgba(163, 200, 58, 0.05) !important;
}

.topnav2 ul.nav li.nav-item > a.active {
  color: #a3c83a !important;
  font-weight: 600 !important;
}

.topnav2 ul.nav li.nav-item > a.active:after {
  content: "" !important;
  position: absolute !important;
  bottom: 0 !important;
  left: 20px !important;
  right: 20px !important;
  height: 3px !important;
  background-color: #a3c83a !important;
  border-radius: 3px 3px 0 0 !important;
}

.dropdown .dropdown-menu {
  border: 1px solid #e9ecef !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07) !important;
  border-radius: 8px !important;
  margin-top: 10px !important;
}

.dropdown .dropdown-menu a.dropdown-item {
  font-size: 13px !important;
  color: #4b5563 !important;
  padding: 10px 20px !important;
  transition: all 0.2s !important;
}

.dropdown .dropdown-menu a.dropdown-item:hover {
  background: #f3f4f6 !important;
  color: #a3c83a !important;
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
  display: none;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px;
  position: fixed;
  right: 15px;
  top: 15px;
  z-index: 1002;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #374151;
  margin: 4px 0;
  transition: all 0.3s;
  border-radius: 2px;
}

.mobile-nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Responsive Styles */
@media (max-width: 768px) {
  /* Header adjustments */
  .header2 {
    padding: 0 15px !important;
  }

  .header2 table {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 0 !important;
  }

  .header2 table td {
    display: block !important;
    width: 100% !important;
  }

  .header2 img[alt*="logo"] {
    width: 180px !important;
  }

  /* Hide desktop user info on mobile */
  .topnav {
    display: none !important;
  }

  .header3 {
    display: none !important;
  }

  /* Mobile navigation button */
  .mobile-nav-toggle {
    display: block !important;
  }

  /* Navigation container */
  .topnav2 {
    position: relative;
  }

  .topnav2 ul.nav {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: white !important;
    flex-direction: column !important;
    padding: 80px 20px 20px !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .topnav2 ul.nav.mobile-open {
    display: flex !important;
  }

  .topnav2 ul.nav li.nav-item {
    width: 100%;
    text-align: left;
  }

  .topnav2 ul.nav li.nav-item > a {
    display: block !important;
    padding: 15px 20px !important;
    border-bottom: 1px solid #e9ecef !important;
    font-size: 15px !important;
  }

  .topnav2 ul.nav li.nav-item > a.active:after {
    display: none !important;
  }

  .topnav2 ul.nav li.nav-item > a.active {
    background: rgba(163, 200, 58, 0.1) !important;
    border-left: 4px solid #a3c83a !important;
  }

  /* Dropdown adjustments for mobile */
  .dropdown .dropdown-toggle:before {
    display: none !important;
  }

  .dropdown .dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #f8f9fa !important;
    display: none !important; /* Hide by default, show on toggle */
    padding: 0 !important;
    border-radius: 0 !important;
  }

  .dropdown.open .dropdown-menu {
    display: block !important;
  }

  .dropdown .dropdown-menu a.dropdown-item {
    padding-left: 40px !important;
    font-size: 14px !important;
  }

  /* Mobile user info section */
  .mobile-user-info {
    display: block !important;
    padding: 20px !important;
    background: #f8f9fa !important;
    border-top: 1px solid #e9ecef !important;
    margin-top: 20px !important;
  }

  .mobile-user-info .user-balance {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    margin-bottom: 10px !important;
  }

  .mobile-user-info .user-name {
    font-size: 14px !important;
    color: #6b7280 !important;
  }
}

@media (max-width: 480px) {
  .header2 img[alt*="logo"] {
    width: 150px !important;
  }

  .topnav2 ul.nav li.nav-item > a {
    font-size: 14px !important;
  }
}

/* Desktop-only user info */
.mobile-user-info {
  display: none;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.mobile-menu-overlay.active {
  display: block;
}

/* ===================================
   Buttons
   =================================== */

.btn-primary {
  background-color: #dbfa5e !important;
  color: black !important;
  padding: 12px 35px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none !important;
  display: inline-block;
}

.btn-primary:hover {
  background-color: #c8e845 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  text-decoration: none !important;
  color: black !important;
}

.btn-primary:visited {
  color: black !important;
}

.btn-secondary {
  background-color: #6c757d !important;
  color: white !important;
  padding: 10px 25px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none !important;
  display: inline-block;
}

.btn-secondary:hover {
  background-color: #5a6268 !important;
  text-decoration: none !important;
  color: white !important;
}

.btn-secondary:visited {
  color: white !important;
}

.btn-info {
  background-color: #17a2b8;
  color: white;
  padding: 10px 25px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-info:hover {
  background-color: #138496;
  text-decoration: none;
  color: white;
}

.btn-send,
.btn-send-sms {
  background: linear-gradient(135deg, #a3c83a 0%, #8fb332 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-send:hover,
.btn-send-sms:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(163, 200, 58, 0.3);
}

.btn-cancel,
.btn-cancel-modal {
  background: #6c757d;
  color: white !important;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
}

.btn-cancel:hover,
.btn-cancel-modal:hover {
  background: #5a6268;
  color: white !important;
  text-decoration: none !important;
}

.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 25px;
  border-top: 1px solid #f0f0f0;
}

/* ===================================
   Tables
   =================================== */

.sender-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.sender-table th {
  background-color: #f8f9fa;
  color: #333;
  font-weight: 600;
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  font-size: 14px;
}

.sender-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
}

.sender-table tr:hover {
  background-color: #f8f9fa;
}

.add-sender-row {
  background-color: #f8f9fa;
}

/* ===================================
   SMS Modal Styles
   =================================== */

.overlay {
  position: fixed !important;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
}

.sms-modal {
  max-width: 500px;
  width: 90%;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 0;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
  background: linear-gradient(135deg, #a3c83a 0%, #8fb332 100%);
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
}

.modal-title {
  color: white;
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.sms-modal .close {
  color: white !important;
  opacity: 0.9;
  font-size: 28px;
  line-height: 20px;
  top: 20px;
  right: 25px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

.sms-modal .close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white !important;
  transform: rotate(90deg);
}

.modal-content {
  padding: 30px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.sms-form {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* ===================================
   Message Compose Styles
   =================================== */

.message-header {
  background: linear-gradient(135deg, #a3c83a 0%, #8fb332 100%);
  padding: 25px 30px;
  color: white;
}

.message-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.message-subtitle {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 5px;
}

.message-form {
  padding: 30px;
}

.sender-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sender-avatar {
  width: 36px;
  height: 36px;
  background: #a3c83a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
}

/* ===================================
   Badges and Labels
   =================================== */

.sender-badge {
  background-color: #a3c83a;
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.balance-badge {
  background-color: #28a745;
  color: white;
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 10px;
}

.rate-badge {
  background-color: #ffc107;
  color: #333;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 10px;
}

.recipient-badge {
  display: inline-block;
  background: #f0f6fc;
  color: #1a73e8;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #dadce0;
}

.recipient-badge-vendor {
  background: #fef7e0;
  color: #b68f00;
  border-color: #f4d03f;
}

.recipient-badge-customer {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #81c784;
}

/* ===================================
   Info Boxes
   =================================== */

.info-box {
  background: #f8f9fa;
  border-left: 4px solid #a3c83a;
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 4px;
}

.info-row {
  display: flex;
  padding: 8px 0;
  align-items: center;
}

.info-label {
  font-weight: 600;
  color: #555;
  margin-right: 10px;
  min-width: 120px;
}

.info-value {
  color: #333;
  font-size: 15px;
}

/* ===================================
   Character Counter
   =================================== */

.char-count,
.char-counter {
  text-align: right;
  font-size: 12px;
  color: #666;
  margin-top: 5px;
}

.char-counter {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.char-count .char-current {
  font-weight: 600;
  color: #333;
  transition: color 0.3s;
}

.char-over-limit {
  color: #dc3545 !important;
}

/* ===================================
   Utility Classes
   =================================== */

.link-action {
  color: #a3c83a;
  text-decoration: none;
  font-size: 13px;
  margin: 0 5px;
}

.link-action:hover {
  text-decoration: underline;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-prefix,
.input-suffix {
  color: #666;
  font-size: 14px;
}

.currency-prefix {
  font-size: 18px;
  color: #666;
  font-weight: 500;
}

.amount-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  font-size: 18px;
}

.success-icon {
  color: #28a745;
  font-size: 20px;
  margin-right: 10px;
}

/* ===================================
   Animations
   =================================== */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===================================
   Form Validation Styles
   =================================== */

.form-input:invalid,
.form-textarea:invalid {
  border-color: #dc3545;
}

.form-input:valid,
.form-textarea:valid {
  border-color: #d0d0d0;
}

.form-input:focus:valid,
.form-textarea:focus:valid {
  border-color: #a3c83a;
}