/* Settings Navigation */
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
}

/* Settings Forms */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 600;
}

/* Badge styles for settings */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.badge-secondary {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

/* Button styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-icon {
    padding: 8px;
    border-radius: 6px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

.text-danger {
    color: #dc2626;
}

.text-warning {
    color: #d97706;
}

.text-success {
    color: #16a34a;
}

.text-muted {
    color: var(--text-muted);
}

/* Form styles */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.required {
    color: #dc2626;
}

/* Table styles */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--text-muted);
    background: var(--bg-surface);
}

tr:hover {
    background: var(--bg-hover);
}

/* Utility classes */
.flex {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.text-center {
    text-align: center;
}

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 11px;
}

.font-medium {
    font-weight: 500;
}

.font-bold {
    font-weight: 600;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.p-2 {
    padding: 8px;
}

.p-4 {
    padding: 16px;
}

.p-6 {
    padding: 24px;
}

.py-4 {
    padding-top: 16px;
    padding-bottom: 16px;
}

.py-8 {
    padding-top: 32px;
    padding-bottom: 32px;
}

.border {
    border: 1px solid var(--border);
}

.border-t {
    border-top: 1px solid var(--border);
}

.rounded {
    border-radius: 6px;
}

.bg-warning\/10 {
    background: rgba(245, 158, 11, 0.1);
}

.max-h-64 {
    max-height: 256px;
}

.overflow-y-auto {
    overflow-y: auto;
}

.space-y-1 > * + * {
    margin-top: 4px;
}

.space-y-2 > * + * {
    margin-top: 8px;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.items-center {
    align-items: center;
}

.flex-column {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Modal */
  .modal { 
    max-width: 95%; 
    margin: 16px;
    max-height: calc(100vh - 32px);
  }
  .modal-header { padding: 16px 20px; }
  .modal-body { padding: 20px; }
  .modal-footer { 
    padding: 14px 20px; 
    flex-wrap: wrap; 
  }
  .modal-footer .btn { 
    flex: 1; 
    justify-content: center; 
  }
  
  /* Grid */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  
  /* Settings nav */
  .nav-item { padding: 10px 14px; font-size: 13px; }
  
  /* Forms */
  .form-group { margin-bottom: 14px; }
  .form-label { font-size: 13px; }
  .form-input, .form-select, .form-textarea { 
    padding: 12px 14px; 
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Buttons */
  .btn { padding: 12px 16px; font-size: 14px; }
  .btn-sm { padding: 8px 12px; font-size: 13px; }
  .btn-xs { padding: 6px 10px; font-size: 12px; }
  
  /* Tables */
  .table-wrapper { 
    border-radius: 8px; 
    margin: 0 -16px;
    width: calc(100% + 32px);
  }
  th, td { padding: 10px 12px; font-size: 13px; }
  
  /* Settings section */
  .settings-section { margin-bottom: 24px; }
  .settings-section h4 { font-size: 11px; margin-bottom: 12px; }
  
  /* Badge */
  .badge { padding: 3px 8px; font-size: 10px; }
}

@media (max-width: 480px) {
  /* Modal */
  .modal { 
    margin: 8px;
    max-height: calc(100vh - 16px);
    border-radius: 8px;
  }
  .modal-header { padding: 14px 16px; }
  .modal-title { font-size: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  
  /* Forms */
  .form-group { margin-bottom: 12px; }
  .form-label { font-size: 12px; margin-bottom: 5px; }
  .form-input, .form-select, .form-textarea { padding: 11px 12px; }
  
  /* Buttons */
  .btn { padding: 11px 14px; width: 100%; justify-content: center; }
  .btn-sm { padding: 8px 12px; }
  .btn-xs { padding: 5px 8px; }
  
  /* Tables */
  .table-wrapper { margin: 0 -12px; width: calc(100% + 24px); }
  th, td { padding: 8px 10px; font-size: 12px; }
  
  /* Settings nav */
  .nav-item { padding: 8px 12px; font-size: 12px; gap: 10px; }
  
  /* Badge */
  .badge { padding: 2px 6px; font-size: 9px; }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .btn, .nav-item {
    min-height: 44px;
    min-width: 44px;
  }
}
