/* FreqDok Admin Console - Shared Styles */
:root {
    --primary: #0066FF;
    --primary-dark: #0052CC;
    --primary-light: #E6F0FF;
    --primary-lighter: #F0F7FF;
    --success: #10B981;
    --success-dark: #059669;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-dark: #D97706;
    --warning-light: #FEF3C7;
    --error: #EF4444;
    --error-dark: #DC2626;
    --error-light: #FEE2E2;
    --purple: #8B5CF6;
    --purple-light: #EDE9FE;
    --bg: #f1f5f9;
    --bg-card: #fff;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
    --shadow-primary: 0 4px 14px rgba(0,102,255,0.25);
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f172a, #1e293b);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #0044AA);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,102,255,0.4);
}
.logo-icon svg { width: 24px; height: 24px; fill: #fff; }

.logo-text { display: flex; flex-direction: column; }
.logo-brand { color: #fff; font-weight: 800; font-size: 1.35rem; }
.logo-badge {
    font-size: 0.6rem;
    background: linear-gradient(135deg, var(--error), #DC2626);
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    width: fit-content;
    margin-top: 4px;
}

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #475569;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.8rem 1.5rem;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary), #0044AA);
    border-radius: 0 3px 3px 0;
    transition: var(--transition);
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active::before { height: 28px; }
.nav-item svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; }

.nav-badge {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: var(--error);
    color: #fff;
    font-size: 0.7rem;
    border-radius: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-badge.success { background: var(--success); }

.nav-sub { padding-left: 3.5rem; font-size: 0.85rem; padding-top: 0.6rem; padding-bottom: 0.6rem; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.2);
}

.admin-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
}

.admin-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), #0044AA);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
}

.admin-name { color: #fff; font-weight: 600; font-size: 0.9rem; }
.admin-role { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(16,185,129,0.6);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Main Content */
.main { flex: 1; margin-left: 280px; display: flex; flex-direction: column; min-height: 100vh; }

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 1rem; }
.header-title { font-size: 1.5rem; font-weight: 800; }
.header-breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-light); }
.header-breadcrumb a { color: var(--text-light); text-decoration: none; }
.header-breadcrumb a:hover { color: var(--primary); }
.header-breadcrumb svg { width: 14px; height: 14px; stroke: currentColor; }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.search-box { position: relative; }
.search-box input {
    width: 300px;
    padding: 0.7rem 1rem 0.7rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--bg);
    transition: var(--transition);
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.search-box svg {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}
.icon-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.icon-btn svg { width: 20px; height: 20px; stroke: var(--text-secondary); fill: none; }
.icon-btn:hover svg { stroke: var(--primary); }
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: var(--error);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

.content { padding: 2rem; flex: 1; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 700; }
.card-body { padding: 1.5rem; }
.card-body.np { padding: 0; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    opacity: 0;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.stat-card:hover::before { opacity: 1; }
.stat-card.blue::before { background: linear-gradient(90deg, var(--primary), #3B82F6); }
.stat-card.green::before { background: linear-gradient(90deg, var(--success), #34D399); }
.stat-card.yellow::before { background: linear-gradient(90deg, var(--warning), #FBBF24); }
.stat-card.red::before { background: linear-gradient(90deg, var(--error), #F87171); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #A78BFA); }

.stat-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon.blue { background: var(--primary-light); }
.stat-icon.blue svg { stroke: var(--primary); }
.stat-icon.green { background: var(--success-light); }
.stat-icon.green svg { stroke: var(--success); }
.stat-icon.yellow { background: var(--warning-light); }
.stat-icon.yellow svg { stroke: var(--warning); }
.stat-icon.red { background: var(--error-light); }
.stat-icon.red svg { stroke: var(--error); }
.stat-icon.purple { background: var(--purple-light); }
.stat-icon.purple svg { stroke: var(--purple); }
.stat-icon svg { width: 26px; height: 26px; fill: none; stroke-width: 1.75; }

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}
.stat-trend.up { background: var(--success-light); color: var(--success-dark); }
.stat-trend.down { background: var(--error-light); color: var(--error-dark); }
.stat-trend svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }

.stat-value { font-size: 2.25rem; font-weight: 800; margin-bottom: 0.25rem; }
.stat-label { color: var(--text-light); font-size: 0.9rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,102,255,0.4); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); }
.btn-danger { background: linear-gradient(135deg, var(--error), var(--error-dark)); color: #fff; }
.btn-success { background: linear-gradient(135deg, var(--success), var(--success-dark)); color: #fff; }
.btn-warning { background: linear-gradient(135deg, var(--warning), var(--warning-dark)); color: #fff; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; }

.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}
.link:hover { color: var(--primary-dark); }
.link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-light); color: var(--success-dark); }
.badge-warning { background: var(--warning-light); color: var(--warning-dark); }
.badge-error { background: var(--error-light); color: var(--error-dark); }
.badge-info { background: var(--primary-light); color: var(--primary-dark); }

.plan-badge { display: inline-flex; padding: 0.4rem 1rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; }
.plan-badge.free { background: var(--bg); color: var(--text-light); }
.plan-badge.pro { background: var(--primary-light); color: var(--primary-dark); }
.plan-badge.business { background: var(--purple-light); color: #7C3AED; }
.plan-badge.enterprise { background: #fef3c7; color: #92400e; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    background: var(--bg);
}
tr:hover td { background: var(--primary-lighter); }

.user-cell { display: flex; align-items: center; gap: 0.875rem; }
.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), #0044AA);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}
.user-name { font-weight: 600; }
.user-email { font-size: 0.8rem; color: var(--text-light); }

.storage-bar { display: flex; align-items: center; gap: 0.75rem; }
.storage-track { flex: 1; height: 8px; background: var(--border); border-radius: 4px; max-width: 120px; overflow: hidden; }
.storage-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.storage-fill.warning { background: var(--warning); }
.storage-fill.danger { background: var(--error); }
.storage-text { font-size: 0.8rem; color: var(--text-light); font-weight: 600; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; }
.form-group .hint { font-size: 0.8rem; color: var(--text-light); margin-top: 0.4rem; }
.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-checkbox { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.form-checkbox input { width: 20px; height: 20px; accent-color: var(--primary); }

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 2rem;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s;
    box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: none;
    background: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: var(--error-light); }
.modal-close svg { width: 20px; height: 20px; stroke: var(--text-secondary); fill: none; }
.modal-body { padding: 1.5rem; overflow-y: auto; max-height: calc(90vh - 160px); }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg);
}

/* Encryption Notice */
.encryption-notice {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--success-light), #d1fae5);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(16,185,129,0.2);
    margin-bottom: 1.5rem;
}
.enc-icon {
    width: 48px;
    height: 48px;
    background: var(--success);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.enc-icon svg { width: 24px; height: 24px; stroke: #fff; fill: none; }
.enc-content h4 { font-size: 0.95rem; font-weight: 700; color: var(--success-dark); margin-bottom: 0.35rem; }
.enc-content p { font-size: 0.85rem; color: #065f46; line-height: 1.6; }

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h2 { font-size: 1.25rem; font-weight: 700; }
.page-header p { color: var(--text-light); font-size: 0.9rem; }
.page-header-actions { display: flex; gap: 0.75rem; }

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.tab {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}
.empty-state .icon {
    width: 80px;
    height: 80px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}
.empty-state .icon svg { width: 40px; height: 40px; stroke: var(--text-muted); fill: none; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-light); margin-bottom: 1.5rem; }

/* Responsive */
@media (max-width: 1400px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1200px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 992px) { .sidebar { transform: translateX(-100%); } .main { margin-left: 0; } }
@media (max-width: 768px) { .stats-grid { grid-template-columns: 1fr; } .header-actions .search-box { display: none; } .form-row { grid-template-columns: 1fr; } }
