/* Custom Modern Red & Black Glassmorphism Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #FCF9F5 0%, #F5EFE6 100%);
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(249, 115, 22, 0.15);
    --panel-hover-border: rgba(249, 115, 22, 0.35);
    
    --primary-cyan: #F97316; /* Warm Orange */
    --primary-purple: #C2410C; /* Dark Orange/Rust */
    --btn-gradient: linear-gradient(135deg, #F97316 0%, #C2410C 100%);
    --btn-danger-gradient: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
    
    --text-primary: #2C2520; /* Deep Charcoal/Warm Brown */
    --text-secondary: #5F554F; /* Soft Warm Gray */
    --text-muted: #8D8078; /* Muted Sand */
    
    --success: #16A34A;
    --warning: #EA580C;
    --danger: #DC2626;
    
    --radius-lg: 16px;
    --radius-md: 8px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 5px rgba(255, 46, 46, 0.2); }
    50% { box-shadow: 0 0 15px rgba(255, 46, 46, 0.5); }
    100% { box-shadow: 0 0 5px rgba(255, 46, 46, 0.2); }
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Glassmorphic Panel Card */
.glass-card {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.55);
    padding: 40px;
    width: 100%;
    animation: fadeIn var(--transition-normal);
    transition: border-color var(--transition-normal);
}

.glass-card:hover {
    border-color: var(--panel-hover-border);
}

.glass-card.auth-card {
    max-width: 480px;
}

.glass-card.dashboard-card {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, #2c2520 0%, #ea580c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.subtitle {
    font-size: 0.95rem;
    margin-top: -5px;
    margin-bottom: 25px;
}

/* Navigation bar */
.nav-bar {
    background: rgba(252, 249, 245, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-cyan);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 46, 46, 0.15);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 10px rgba(255, 46, 46, 0.25);
    background: rgba(0, 0, 0, 0.5);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 15px;
}

.form-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-cyan);
    cursor: pointer;
}

/* Switches (Toggles) */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 46, 46, 0.08);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.switch-label {
    font-weight: 500;
}

.switch-subtext {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: #eee;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-image: var(--btn-gradient);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background-color: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
    gap: 8px;
    width: 100%;
}

.btn-primary {
    background-image: var(--btn-gradient);
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 51, 51, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 46, 46, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 46, 46, 0.3);
}

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

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 26, 26, 0.4);
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-outline-danger:hover {
    background: rgba(255, 51, 51, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    width: auto;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    width: auto;
    border-radius: 4px;
}

/* Toast Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: none;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(255, 46, 46, 0.15);
    border-color: rgba(255, 46, 46, 0.3);
    color: #ff9999;
}

.alert-success {
    background: rgba(40, 199, 111, 0.15);
    border-color: rgba(40, 199, 111, 0.3);
    color: #7be3a9;
}

.alert-info {
    background: rgba(255, 46, 46, 0.1);
    border-color: rgba(255, 46, 46, 0.25);
    color: #ffa8a8;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-admin {
    background: rgba(153, 0, 0, 0.2);
    color: #ffa3a3;
    border: 1px solid rgba(153, 0, 0, 0.4);
}

.badge-user {
    background: rgba(255, 46, 46, 0.15);
    color: #ffb8b8;
    border: 1px solid rgba(255, 46, 46, 0.3);
}

.badge-active {
    background: rgba(40, 199, 111, 0.15);
    color: #7be3a9;
}

.badge-inactive {
    background: rgba(255, 46, 46, 0.15);
    color: #ff9999;
}

/* Table Style */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 46, 46, 0.05);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover td {
    background: rgba(255, 46, 46, 0.02);
}

td {
    font-size: 0.95rem;
}

/* Dashboard Panels */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    }
    
    .dashboard-grid.admin-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Profile details */
.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 46, 46, 0.05);
}

.meta-key {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.meta-value {
    font-weight: 500;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 1, 1, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: #FFFFFF;
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
    animation: fadeIn var(--transition-fast) forwards;
    color: var(--text-primary);
}

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

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--primary-cyan);
}

.modal-body {
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

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

/* 2FA Setup Panels */
.twofa-setup-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding: 10px 0;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: white;
    padding: 10px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-placeholder canvas {
    width: 100% !important;
    height: 100% !important;
}

.secret-key-display {
    background: rgba(249, 115, 22, 0.05);
    border: 1px dashed rgba(249, 115, 22, 0.3);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    user-select: all;
    color: var(--primary-cyan);
}

/* Logs panel */
.logs-panel {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid rgba(255, 46, 46, 0.1);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.4);
}

.log-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 46, 46, 0.05);
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    gap: 15px;
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
    white-space: nowrap;
}

.log-details {
    color: var(--text-primary);
    flex-grow: 1;
}

.log-action {
    font-weight: 600;
    color: var(--primary-cyan);
    white-space: nowrap;
}

.log-ip {
    color: var(--text-secondary);
}

/* Telegram Setup styles */
.telegram-instructions {
    text-align: left;
    width: 100%;
}

.telegram-step {
    margin-bottom: 15px;
}

.telegram-step h4 {
    font-size: 0.95rem;
    color: var(--primary-cyan);
    margin-bottom: 5px;
}

.telegram-step p {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.link-button-wrapper {
    margin: 15px 0;
    width: 100%;
}

.link-code-highlight {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-cyan);
    letter-spacing: 0.2em;
    text-align: center;
    background: rgba(249, 115, 22, 0.05);
    border: 1px solid rgba(249, 115, 22, 0.2);
    padding: 10px;
    border-radius: var(--radius-md);
    margin-top: 10px;
}

/* Custom Footer */
footer {
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--panel-border);
    margin-top: auto;
    background: rgba(10, 5, 5, 0.6);
}

/* --- Responsive UI Improvements --- */

/* Hamburger Toggle Button */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
    z-index: 1010;
}

.nav-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

/* Active Hamburger Animation */
.nav-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(15, 8, 8, 0.98);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--panel-border);
        padding: 20px;
        z-index: 999;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu .nav-link {
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 46, 46, 0.05);
        font-size: 1.05rem;
    }
    
    .nav-menu .nav-link:last-of-type {
        border-bottom: none;
    }
    
    .nav-menu span {
        margin: 5px 0 !important;
        display: block;
    }
    
    .nav-menu .btn {
        margin-top: 10px;
        width: 100% !important;
    }
    
    .log-item {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
        padding: 12px;
    }
    .log-time, .log-ip {
        font-size: 0.75rem;
    }

    .glass-card {
        padding: 20px;
    }
    .dashboard-grid .glass-card {
        padding: 15px !important;
    }
}

@media (max-width: 576px) {
    .meta-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

