:root {
    --primary: #032a56;
    --primary-light: #0a468d;
    --accent: #00d2ff;
    --bg: #f4f7fa;
    --card: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --danger: #ff7675;
    --success: #55efc4;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* Auth Pages */
.auth-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #001a33 100%);
}

.auth-card {
    background: var(--card);
    padding: 3rem;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    text-align: center;
}

.auth-card img {
    width: 150px;
    margin-bottom: 2rem;
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.form-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #edf2f7;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
}

input:focus, select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(3, 42, 86, 0.1);
}

.btn {
    cursor: pointer;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

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

.sidebar {
    width: 260px;
    background-color: var(--primary);
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.sidebar .logo {
    width: 100%;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 2rem;
}

.nav-item {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(255,255,255,0.1);
    color: var(--accent);
}

.nav-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 5px;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.avatar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    margin-bottom: 2rem;
}

.avatar-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.user-info-sidebar {
    display: flex;
    flex-direction: column;
}

.user-name-sidebar {
    font-weight: 700;
    font-size: 0.9rem;
}

.user-role-sidebar {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-content {
    flex: 1;
    padding: 2rem 3rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    gap: 2rem;
}

header h1 {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header-logo-right {
    height: 45px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
}

.data-table-container {
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

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

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--bg);
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--bg);
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active { background: #e6fffa; color: #38b2ac; }
.status-expired { background: #fff5f5; color: #f56565; }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.chart-card {
    background: var(--card);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    padding: 2rem;
}
.badge {
    background: #e2e8f0;
    color: #475569;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

pre {
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-family: 'Courier New', Courier, monospace; white-space: pre-wrap; word-break: break-all; max-width: 400px;
}
.url-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}

.url-cell a {
    color: var(--primary);
    text-decoration: none;
}

.url-cell a:hover {
    text-decoration: underline;
}

.btn-edit {
    background: #f0f7ff;
    color: #032a56;
    padding: 0.4rem;
}

.btn-edit:hover {
    background: #e0efff;
}

.btn-delete {
    background: #fff5f5;
    color: #c53030;
    padding: 0.4rem;
}

.btn-delete:hover {
    background: #fed7d7;
}

/* User & Profile Styles */
.user-avatar-header {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-card {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    border: 4px solid var(--bg);
}

.role-tag {
    display: inline-block;
    padding: 0.2rem 1rem;
    background: var(--bg);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2rem;
}

/* Mobile Bar */
.mobile-bar {
    display: none;
    background: white;
    padding: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #edf2f7;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

/* Responsive Design */
@media (max-width: 992px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        padding: 2rem;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-bar {
        display: flex;
    }

    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 50px; /* height of mobile bar */
        left: -260px; /* width of sidebar */
        width: 260px;
        height: calc(100vh - 50px);
        z-index: 99;
        transition: all 0.3s ease;
        flex-direction: column;
        padding: 1.5rem;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar .logo {
        display: none;
    }

    .sidebar .nav-item {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    header {
        margin-bottom: 1.5rem;
    }

    .header-right {
        display: none; /* hidden on mobile, info in mobile bar */
    }

    header h1 {
        font-size: 1.5rem;
    }

    .data-table-container {
        padding: 1rem;
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .modal {
        padding: 1.5rem;
        width: 95%;
    }

    .auth-card {
        padding: 2rem;
        margin: 1rem;
    }
}

/* Surfer WV Specific Styles */
.modal-lg {
    max-width: 780px !important;
    max-height: 90vh;
    overflow-y: auto;
}

.form-section {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-section h4 {
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.8rem;
}

@media (max-width: 600px) {
    .form-grid-2, .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

.topic-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #e0f2fe;
    color: #0369a1;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid #bae6fd;
}

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #334155;
}

.chip-accent {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.chip-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.chip-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.switch-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.shortcut-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.6rem;
}

.shortcut-row input {
    margin: 0;
    padding: 0.55rem 0.8rem;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #edf2f7;
    color: var(--text);
}

.btn-icon:hover {
    background: #e2e8f0;
}

.btn-sync {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
}

.btn-sync:hover {
    background: #bae6fd;
    color: #0369a1;
}

.apps-checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-top: 0.5rem;
}

.apps-checkbox-group label {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.apps-checkbox-group label:hover {
    background: rgba(0, 210, 255, 0.05);
}

.apps-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

