/* SAIDD Admin Dashboard Styles */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #d97706;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
}

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--gray-900);
    color: white;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--gray-700);
    margin-bottom: 8px;
}

.sidebar-brand h1 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-brand .brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
}

.sidebar-brand small {
    display: block;
    color: var(--gray-400);
    font-size: 12px;
    margin-top: 4px;
}

.sidebar nav { flex: 1; }

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.sidebar a:hover { background: var(--gray-800); color: white; }
.sidebar a.active { background: var(--primary); color: white; }
.sidebar a .icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-700);
}

.sidebar-footer .user-info {
    font-size: 13px;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.sidebar-footer .user-info strong { color: white; }

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px;
    max-width: 1200px;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .label {
    font-size: 13px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card .value.primary { color: var(--primary); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }

/* Tables */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body { padding: 20px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

tr:hover td { background: var(--gray-50); }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-collected { background: #dcfce7; color: #15803d; }
.badge-deleted { background: #fee2e2; color: #991b1b; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-expired { background: var(--gray-200); color: var(--gray-600); }
.badge-admin { background: #e0e7ff; color: #3730a3; }
.badge-client { background: #fef3c7; color: #92400e; }
.badge-system { background: var(--gray-200); color: var(--gray-600); }

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

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

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-outline {
    background: white;
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 6px 8px; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s;
    background: white;
    color: var(--gray-900);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select.form-control { cursor: pointer; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Filters bar */
.filters {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filters .form-control {
    width: auto;
    min-width: 160px;
}

/* Modal */
.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;
}

.modal {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Checkbox in tables */
.row-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #eef2ff;
    border-radius: 6px;
}

.toolbar .selected-count {
    font-size: 13px;
    color: var(--gray-600);
    margin-right: auto;
}

/* Text utilities */
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-mono { font-family: 'SF Mono', 'Consolas', monospace; }
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

/* Copy button */
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--gray-400);
}
.copy-btn:hover { background: var(--gray-100); color: var(--gray-600); }

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    padding: 40px;
    max-width: 400px;
    width: 100%;
}

.login-card h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 24px;
    font-size: 14px;
}

.login-card .login-logo {
    display: block;
    margin: 0 auto 16px;
    max-width: 120px;
    max-height: 60px;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--gray-900);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
