:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --primary-color: #8b5cf6;
    /* Violet */
    --primary-hover: #7c3aed;
    --secondary-color: #3b82f6;
    /* Blue */
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --radius: 16px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: linear-gradient(135deg, #050a15 0%, #111422 100%);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: rgba(15, 23, 42, 0.95);
    border-right: var(--glass-border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    z-index: 100;
    transition: transform 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

/* Mobile Sidebar */
.menu-toggle {
    display: none;
}

/* Mobile Sidebar & Layout Adjustments */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        background: #0f172a;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Overlay when sidebar is open */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 90;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4.5rem;
        /* Space for toggle */
    }

    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        z-index: 101;
        top: 1rem;
        left: 1rem;
        right: auto;
        background: rgba(15, 23, 42, 0.8);
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Aggressive scaling for 'Exaggerated' feel */
    .app-container {
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 1rem;
    }

    p {
        font-size: 0.85rem;
    }

    .main-content {
        padding: 0.5rem;
        padding-top: 4rem;
    }

    /* Smaller Inputs/Buttons */
    input,
    select,
    textarea {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Compact Panels */
    .glass-panel {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .nav-brand {
        margin-bottom: 1rem;
        font-size: 1.25rem;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .login-card {
        padding: 1rem;
        width: 95%;
    }
}

/* Card View for Tables on Mobile */
/* Compact Table Rows on Mobile */
@media (max-width: 768px) {

    table,
    tbody {
        display: block;
    }

    thead {
        display: none;
    }

    /* Hide headers */

    tr {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        padding: 0.5rem;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }

    td {
        display: block;
        border: none !important;
        padding: 0;
    }

    td:first-child {
        flex: 1;
        min-width: 0;
        padding-right: 0.5rem;
        word-break: break-word;
    }

    .hide-mobile {
        display: none !important;
    }

    /* Toggle Actions */
    .actions-desktop {
        display: none !important;
    }

    .actions-mobile {
        display: block !important;
        position: relative;
    }

    .mobile-dropdown {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        top: auto;
        right: auto;
        background: #1e293b;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px 12px 0 0;
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        animation: slideUp 0.3s ease-out;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .mobile-dropdown button,
    .mobile-dropdown a {
        display: flex;
        align-items: center;
        width: 100%;
        text-align: left;
        padding: 0.75rem 1rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        color: white;
        font-size: 1rem;
    }

    .mobile-dropdown button i,
    .mobile-dropdown a i {
        margin-right: 1rem;
        width: 20px;
        text-align: center;
    }

    .mobile-dropdown button:hover,
    .mobile-dropdown a:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}


/* General Improvements */
.glass-panel {
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Softer border */
}

/* Dynamic Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}


/* Navigation */
.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 3rem;
    text-align: center;
    letter-spacing: -0.5px;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-color);
}

.nav-icon {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Utils */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
}

.stat-title {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-success {
    color: var(--success-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-color);
}

.badge-expired {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.badge-blocked {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

/* Action Buttons */
.action-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    margin-right: 0.25rem;
    color: white;
}

.btn-whatsapp {
    background: #25D366;
}

.btn-telegram {
    background: #0088cc;
}

.btn-edit {
    background: var(--secondary-color);
}

.btn-delete {
    background: var(--danger-color);
}

/* Login Specific */
.login-body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.search-bar {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    /* Prevent modal from exceeding screen height */
    overflow-y: auto;
    /* Enable scrolling inside modal */
    scrollbar-width: thin;
    /* Firefox */
}

/* Allow 2 columns on mobile for compact fields */
@media (max-width: 768px) {
    .form-row-2.mobile-2col {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive Forms */
.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.date-range-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-range-group input {
    flex: 1;
    width: 100%;
}

.date-separator {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .form-row-2.mobile-2col {
        grid-template-columns: 1fr 1fr;
        /* Keep 2 cols if specified */
        gap: 0.5rem;
    }

    .date-range-group {
        flex-direction: column;
        align-items: stretch;
    }

    .date-separator {
        display: none;
    }
}