/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.app-container {
  min-height: 100vh;
}

/* Login Screen Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 400px;
  padding: 40px;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header i {
  font-size: 3rem;
  color: #667eea;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 8px;
}

.login-header p {
  color: #718096;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
}

.form-group label i {
  margin-right: 8px;
  color: #667eea;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn i {
  margin-right: 8px;
}

.error-message {
  background: #fed7d7;
  color: #c53030;
  padding: 12px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 0.9rem;
  text-align: center;
}

/* Dashboard Styles */
.dashboard-container {
  min-height: 100vh;
  background: #f7fafc;
}

.dashboard-header {
  background: white;
  padding: 16px 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left h1 {
  color: #2d3748;
  font-size: 1.5rem;
  font-weight: 700;
}

.header-left h1 i {
  color: #667eea;
  margin-right: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  color: #4a5568;
  font-weight: 500;
}

.logout-btn {
  background: #e53e3e;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: #c53030;
}

.logout-btn i {
  margin-right: 6px;
}

/* Tab Navigation */
.tab-navigation {
  background: white;
  padding: 0 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  padding: 16px 20px;
  cursor: pointer;
  color: #718096;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #4a5568;
  background: #f7fafc;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.tab-btn i {
  margin-right: 8px;
}

/* Main Content */
.dashboard-main {
  padding: 24px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.content-header h2 {
  color: #2d3748;
  font-size: 1.5rem;
  font-weight: 700;
}

.content-header h2 i {
  color: #667eea;
  margin-right: 12px;
}

.refresh-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: #5a67d8;
}

.refresh-btn i {
  margin-right: 6px;
}

.content-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.danger-btn {
  background: #e53e3e;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.danger-btn:hover {
  background: #c53030;
}

.danger-btn:disabled {
  background: #fc8181;
  cursor: not-allowed;
}

.danger-btn i {
  margin-right: 6px;
}

/* Health Status Grid */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.health-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.2s ease;
}

.health-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.card-header {
  background: #f7fafc;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.card-header h3 {
  color: #2d3748;
  font-size: 1.1rem;
  font-weight: 600;
}

.card-header h3 i {
  color: #667eea;
  margin-right: 8px;
}

.card-content {
  padding: 20px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

.status-item:last-child {
  border-bottom: none;
}

.status-item .label {
  color: #4a5568;
  font-weight: 500;
}

.status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status.running {
  background: #c6f6d5;
  color: #22543d;
}

.status.checking {
  background: #fef5e7;
  color: #c05621;
}

.status.error {
  background: #fed7d7;
  color: #c53030;
}

.status.active {
  background: #bee3f8;
  color: #2c5282;
}

.status.disabled {
  background: #edf2f7;
  color: #4a5568;
}

.status.not-configured {
  background: #f7fafc;
  color: #4a5568;
}

/* Text color utilities */
.text-success {
  color: #22543d !important;
  font-weight: 600;
}

.text-error {
  color: #c53030 !important;
  font-weight: 600;
}

.error-text {
  color: #c53030;
  font-size: 0.8rem;
  font-style: italic;
  max-width: 200px;
  word-wrap: break-word;
}

/* Mobile Tab Selector */
.mobile-tab-selector {
  display: none;
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #4a5568;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.mobile-tab-selector:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* R2 Dashboard Styles */
.r2-dashboard {
  margin-top: 20px;
}

.r2-section {
  margin-bottom: 30px;
}

.r2-section h3 {
  color: #2d3748;
  font-size: 1.2rem;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.r2-section h3 i {
  color: #667eea;
}

.r2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.r2-card {
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.r2-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.r2-card-header {
  background: #f7fafc;
  padding: 12px 16px;
  font-weight: 600;
  color: #4a5568;
  border-bottom: 1px solid #e2e8f0;
}

.r2-card-content {
  padding: 16px;
}

.r2-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

.r2-item:last-child {
  border-bottom: none;
}

.r2-item .label {
  color: #4a5568;
  font-weight: 500;
}

.r2-stat-large {
  text-align: center;
  margin-bottom: 15px;
}

.r2-stat-large .stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: #667eea;
  line-height: 1;
}

.r2-stat-large .stat-label {
  display: block;
  color: #4a5568;
  font-size: 0.9rem;
  margin-top: 4px;
}

.r2-file-list {
  max-height: 300px;
  overflow-y: auto;
}

.r2-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.r2-file-item:last-child {
  border-bottom: none;
}

.r2-file-info {
  flex: 1;
}

.r2-file-name {
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 2px;
}

.r2-file-details {
  font-size: 0.8rem;
  color: #718096;
}

.r2-file-type {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.r2-file-type.video {
  background: #fed7d7;
  color: #c53030;
}

.r2-file-type.file {
  background: #e2e8f0;
  color: #4a5568;
}

/* Loading States */
.loading {
  text-align: center;
  padding: 40px;
  color: #718096;
}

.loading i {
  font-size: 2rem;
  margin-bottom: 16px;
}

/* Placeholder Content */
.placeholder-content {
  text-align: center;
  padding: 80px 20px;
  color: #718096;
}

.placeholder-content i {
  margin-bottom: 20px;
  opacity: 0.5;
}

.placeholder-content p {
  font-size: 1.1rem;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: center;
    /* Center the title */
    gap: 12px;
  }

  .header-left {
    width: 100%;
    text-align: center;
    /* Center the title */
  }

  .header-left h1 {
    font-size: 1.3rem;
    /* Slightly smaller on mobile */
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .user-info {
    display: none;
    /* Hide "Welcome, Admin" text */
  }

  /* Show mobile dropdown selector */
  .mobile-tab-selector {
    display: block;
  }

  /* Hide desktop tab navigation */
  .tab-navigation {
    display: none;
  }

  .dashboard-main {
    padding: 16px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .health-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .login-card {
    padding: 30px 20px;
  }
}

@media (max-width: 480px) {
  .login-card {
    margin: 10px;
    padding: 24px 16px;
  }

  .login-header h1 {
    font-size: 1.5rem;
  }

  .dashboard-main {
    padding: 12px;
  }
}

/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fa-spin {
  animation: spin 1s linear infinite;
}

/* Twilio Service Specific Styles - Namespaced to avoid conflicts */
#twilio-tab .admin-section {
  margin-bottom: 32px;
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9ecef;
}

#twilio-tab .admin-section h3 {
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f8f9fa;
  display: flex;
  align-items: center;
  gap: 10px;
}

#twilio-tab .info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

#twilio-tab .info-card {
  background: #f8f9fb;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px 20px;
  transition: all 0.2s ease;
}

#twilio-tab .info-card:hover {
  background: #f1f3f7;
  border-color: #d1d9e6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#twilio-tab .info-label {
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

#twilio-tab .info-value {
  font-size: 16px;
  font-weight: 500;
  color: #2c3e50;
  word-break: break-all;
}

/* Twilio Status Breakdown - Scoped to prevent conflicts */
#twilio-tab .twilio-status-breakdown {
  margin: 24px 0;
  background: #f8f9fb;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e9ecef;
}

#twilio-tab .twilio-status-breakdown h4 {
  margin-bottom: 16px;
  color: #2c3e50;
  font-weight: 600;
  font-size: 16px;
}

#twilio-tab .twilio-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

#twilio-tab .twilio-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
}

#twilio-tab .twilio-status-item:hover {
  border-color: #007bff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

/* Twilio Message Status Badges - Scoped to prevent health tab conflicts */
#twilio-tab .twilio-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#twilio-tab .twilio-status-badge.status-delivered {
  background-color: #d1f2d8;
  color: #0d5016;
  border: 1px solid #b8e5c1;
}

#twilio-tab .twilio-status-badge.status-sent {
  background-color: #cfe2ff;
  color: #084298;
  border: 1px solid #b6d4fe;
}

#twilio-tab .twilio-status-badge.status-failed {
  background-color: #f8d7da;
  color: #58151c;
  border: 1px solid #f5c2c7;
}

#twilio-tab .twilio-status-badge.status-pending {
  background-color: #fff3cd;
  color: #664d03;
  border: 1px solid #ffecb5;
}

#twilio-tab .twilio-status-badge.status-undelivered {
  background-color: #f8d7da;
  color: #58151c;
  border: 1px solid #f5c2c7;
}

#twilio-tab .twilio-status-count {
  font-weight: 700;
  font-size: 18px;
  color: #2c3e50;
}

/* Twilio Table Styles - Scoped and improved */
#twilio-tab .table-container {
  margin: 24px 0 0 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e9ecef;
}

#twilio-tab .table-container h4 {
  margin: 0;
  padding: 16px 20px;
  background: #f8f9fb;
  color: #2c3e50;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e9ecef;
}

/* Table Header with Filter Dropdown */
#twilio-tab .table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #f8f9fb;
  border-bottom: 1px solid #e9ecef;
}

#twilio-tab .table-header h4 {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  color: #2c3e50;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#twilio-tab .filter-dropdown {
  background: white;
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  min-width: 120px;
}

#twilio-tab .filter-dropdown:hover {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

#twilio-tab .filter-dropdown:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

#twilio-tab .data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  margin: 0;
}

#twilio-tab .data-table th,
#twilio-tab .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f1f3f5;
  font-size: 14px;
}

#twilio-tab .data-table th {
  background: #f8f9fb;
  font-weight: 600;
  color: #495057;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e9ecef;
}

#twilio-tab .data-table tbody tr:hover {
  background: #f8f9fb;
}

#twilio-tab .data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
  #twilio-tab .info-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  #twilio-tab .twilio-status-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  #twilio-tab .twilio-status-item {
    padding: 10px 12px;
  }

  #twilio-tab .data-table {
    font-size: 13px;
  }

  #twilio-tab .data-table th,
  #twilio-tab .data-table td {
    padding: 8px 12px;
  }

  #twilio-tab .admin-section {
    padding: 16px;
    margin-bottom: 20px;
  }

  #twilio-tab .table-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px;
  }

  #twilio-tab .table-header h4 {
    text-align: center;
  }

  #twilio-tab .filter-dropdown {
    align-self: center;
    min-width: 150px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  #twilio-tab .info-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #twilio-tab .twilio-status-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #twilio-tab .data-table {
    font-size: 12px;
  }

  #twilio-tab .data-table th,
  #twilio-tab .data-table td {
    padding: 6px 8px;
  }

  #twilio-tab .admin-section {
    padding: 12px;
    margin-bottom: 16px;
  }

  #twilio-tab .info-card {
    padding: 12px 16px;
  }
}

/* Header Actions Layout */
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Test Button Styles */
.test-btn {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.test-btn:hover {
  background: linear-gradient(135deg, #218838, #1ea085);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.test-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.test-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #e9ecef;
  color: #495057;
}

.modal-form {
  padding: 24px;
}

.modal-form .form-group {
  margin-bottom: 20px;
}

.modal-form .form-group:last-child {
  margin-bottom: 0;
}

.modal-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
  font-size: 14px;
}

.modal-form input,
.modal-form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.modal-form input:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.modal-form textarea {
  resize: vertical;
  min-height: 100px;
}

.form-help {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6c757d;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.cancel-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cancel-btn:hover {
  background: #5a6268;
}

.send-btn {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.send-btn:hover {
  background: linear-gradient(135deg, #0056b3, #004085);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.send-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.test-result {
  padding: 20px 24px;
  border-top: 1px solid #e9ecef;
  margin-top: 0;
}

.test-result.success {
  background: #d1f2d8;
  color: #0d5016;
  border-left: 4px solid #28a745;
}

.test-result.error {
  background: #f8d7da;
  color: #58151c;
  border-left: 4px solid #dc3545;
}

/* Mobile Modal Responsiveness */
@media (max-width: 768px) {
  .modal {
    padding: 10px;
  }

  .modal-content {
    max-width: 100%;
    margin: 0;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-form {
    padding: 20px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .cancel-btn,
  .send-btn {
    width: 100%;
    justify-content: center;
  }

  .header-actions {
    gap: 8px;
  }

  .test-btn {
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* =============================================================================
   ACTIVETRAIL TAB STYLES
   ============================================================================= */

/* ActiveTrail Service Styles */
#activetrail-tab {
  color: var(--text-primary);
}

#activetrail-tab .admin-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(255, 138, 28, 0.1);
}

#activetrail-tab .admin-section h3 {
  color: #ff8a1c;
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.5rem 0;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255, 138, 28, 0.2);
}

#activetrail-tab .admin-section h3 i {
  color: #ff8a1c;
  width: 24px;
  text-align: center;
}

#activetrail-tab .section-header-with-filter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255, 138, 28, 0.2);
}

#activetrail-tab .section-header-with-filter h3 {
  color: #ff8a1c;
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: none;
}

#activetrail-tab .filter-dropdown {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 138, 28, 0.3);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

#activetrail-tab .filter-dropdown:hover {
  border-color: #ff8a1c;
  box-shadow: 0 2px 4px rgba(255, 138, 28, 0.2);
}

#activetrail-tab .filter-dropdown:focus {
  outline: none;
  border-color: #ff8a1c;
  box-shadow: 0 0 0 3px rgba(255, 138, 28, 0.1);
}

#activetrail-tab .info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

#activetrail-tab .info-card {
  background: linear-gradient(135deg, rgba(255, 138, 28, 0.05), rgba(255, 138, 28, 0.1));
  border: 1px solid rgba(255, 138, 28, 0.2);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#activetrail-tab .info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 138, 28, 0.15);
  border-color: #ff8a1c;
}

#activetrail-tab .info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #ff8a1c, #ffb366);
}

#activetrail-tab .info-card.success::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

#activetrail-tab .info-card.warning::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

#activetrail-tab .info-card.error::before {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

#activetrail-tab .info-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

#activetrail-tab .info-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ff8a1c;
  line-height: 1.2;
}

#activetrail-tab .info-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  align-items: center;
}

#activetrail-tab .info-detail .label {
  font-weight: 600;
  color: #666;
  margin-right: 0.25rem;
}

#activetrail-tab .info-card.success .info-value {
  color: #10b981;
}

#activetrail-tab .info-card.warning .info-value {
  color: #f59e0b;
}

#activetrail-tab .info-card.error .info-value {
  color: #ef4444;
}

#activetrail-tab .alerts-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#activetrail-tab .alert {
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

#activetrail-tab .alert.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

#activetrail-tab .alert.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

#activetrail-tab .alert.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

#activetrail-tab .alert.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
}

#activetrail-tab .loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1rem;
  color: #ff8a1c;
}

#activetrail-tab .loading-state i {
  font-size: 2rem;
  color: #ff8a1c;
}

/* Test SMS Button in header */
#activetrail-tab .header-actions .test-btn {
  background: linear-gradient(135deg, #ff8a1c, #ffb366);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#activetrail-tab .header-actions .test-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 138, 28, 0.3);
  background: linear-gradient(135deg, #e6781a, #ff8a1c);
}

/* ActiveTrail SMS Test Modal */
.activetrail-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.activetrail-modal-content {
  background: var(--card-bg);
  margin: 5% auto;
  padding: 0;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
  border: 1px solid rgba(255, 138, 28, 0.2);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.activetrail-modal-header {
  background: linear-gradient(135deg, #ff8a1c, #ffb366);
  color: white;
  padding: 1.5rem 2rem;
  border-radius: 16px 16px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activetrail-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.activetrail-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.activetrail-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.activetrail-modal-body {
  padding: 2rem;
}

.activetrail-form-group {
  margin-bottom: 1.5rem;
}

.activetrail-form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.activetrail-form-group input,
.activetrail-form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid rgba(255, 138, 28, 0.2);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.activetrail-form-group input:focus,
.activetrail-form-group textarea:focus {
  outline: none;
  border-color: #ff8a1c;
  box-shadow: 0 0 0 3px rgba(255, 138, 28, 0.1);
}

.activetrail-form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.activetrail-char-counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.activetrail-char-counter.warning {
  color: #f59e0b;
}

.activetrail-char-counter.error {
  color: #ef4444;
}

.activetrail-modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.activetrail-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.activetrail-btn-primary {
  background: linear-gradient(135deg, #ff8a1c, #ffb366);
  color: white;
}

.activetrail-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 138, 28, 0.3);
}

.activetrail-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.activetrail-btn-secondary {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.activetrail-btn-secondary:hover {
  background: var(--surface-color);
}

/* Responsive adjustments for ActiveTrail */
@media (max-width: 768px) {
  #activetrail-tab .info-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  #activetrail-tab .section-header-with-filter {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  #activetrail-tab .filter-dropdown {
    width: 100%;
  }

  #activetrail-tab .info-card {
    padding: 1rem;
  }

  #activetrail-tab .info-value {
    font-size: 1.5rem;
  }

  .activetrail-modal-content {
    margin: 10% auto;
    width: 95%;
  }

  .activetrail-modal-header {
    padding: 1rem 1.5rem;
  }

  .activetrail-modal-body {
    padding: 1.5rem;
  }

  .activetrail-modal-actions {
    flex-direction: column;
  }
}

/* DB Tools Specific Styles */
.db-tool-actions {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #667eea;
  font-size: 14px;
  font-weight: 500;
}

.loading-indicator i {
  color: #667eea;
}

.status-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
}

.feature-list li {
  padding: 6px 0;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.feature-list i {
  color: #667eea;
  width: 16px;
  text-align: center;
}

.primary-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Server Logs Styles */
.logs-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.logs-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.logs-date-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #333;
}

.logs-date-input {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font: inherit;
  color: #333;
  background: #fff;
}

.logs-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  color: #666;
}

.logs-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px);
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.logs-search-box,
.logs-type-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.logs-search-box label,
.logs-type-box label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.logs-search-input,
.logs-type-filter {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font: inherit;
  color: #333;
  background: #fff;
}

.logs-path {
  font-family: 'Courier New', monospace;
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.logs-list {
  overflow: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  max-height: 680px;
  background: #fff;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.logs-table th,
.logs-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eceff3;
  text-align: left;
  vertical-align: top;
}

.logs-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f8fa;
  color: #333;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.logs-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.logs-sort-btn i {
  width: 10px;
  color: #667085;
  font-size: 11px;
}

.logs-sort-btn:focus-visible {
  outline: 2px solid #4a90e2;
  outline-offset: 3px;
}

.logs-table th:nth-child(1),
.logs-table td:nth-child(1) {
  width: 240px;
}

.logs-table th:nth-child(2),
.logs-table td:nth-child(2) {
  width: 110px;
}

.logs-table tr:last-child td {
  border-bottom: none;
}

.logs-table tbody tr:hover {
  background: #f9fbff;
}

.log-datetime {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #475467;
  white-space: nowrap;
}

.log-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4657b8;
  font-size: 11px;
  font-weight: 700;
}

.log-type-error {
  background: #fdecec;
  color: #b42318;
}

.log-type-warn,
.log-type-warning {
  background: #fff7e6;
  color: #b54708;
}

.log-type-info {
  background: #e8f3ff;
  color: #175cd3;
}

.log-details {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}

.no-logs {
  padding: 18px;
  color: #666;
  text-align: center;
}

.log-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s;
  cursor: pointer;
}

.log-file-item:hover {
  background: #f0f0f0;
  border-color: #667eea;
  transform: translateY(-1px);
}

.log-file-info {
  flex: 1;
}

.log-file-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.log-file-meta {
  font-size: 12px;
  color: #666;
}

.log-file-size {
  font-weight: 500;
  color: #667eea;
}

.log-file-actions {
  display: flex;
  gap: 8px;
}

.btn-view-log {
  background: #667eea;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-view-log:hover {
  background: #5a6fd8;
  transform: translateY(-1px);
}

.log-viewer-actions {
  display: flex;
  gap: 10px;
}

.log-content {
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  padding: 16px;
  border-radius: 6px;
  max-height: 600px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid #333;
}

.log-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.log-content::-webkit-scrollbar-track {
  background: #2d2d2d;
}

.log-content::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.log-file-info .log-meta {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

/* Mobile responsive for logs */
@media (max-width: 768px) {
  .logs-filter-bar {
    grid-template-columns: 1fr;
  }

  .logs-table {
    min-width: 720px;
  }

  .log-file-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .log-file-actions {
    margin-top: 8px;
    width: 100%;
    justify-content: flex-end;
  }

  .log-content {
    font-size: 10px;
    max-height: 400px;
  }
}