:root {
    --bg-dark: #071739;
    --bg-card: #0f2350;
    --header-bg: #0a1c40;
    --sidebar-bg: #0a1c40;
    --primary-cyan: #00bfff;
    --primary-blue: #0099ff;
    --text-light: #ffffff;
    --text-muted: #a0b2d1;
    --border-color: #1a3c8a;
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-color: #ffffff;
    --input-border: #1a3c8a;
}

[data-theme="light"] {
    --bg-dark: #f4f7f6;
    --bg-card: #ffffff;
    --header-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --primary-cyan: #007bff;
    --primary-blue: #0056b3;
    --text-light: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --input-bg: #f9f9f9;
    --input-color: #333333;
    --input-border: #cccccc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at top right, rgba(0, 191, 255, 0.1) 0%, var(--bg-dark) 50%);
    color: var(--text-light);
    transition: background-color 0.3s, color 0.3s;
}

[data-theme="light"] body {
    background-image: none !important;
    background-color: #f4f7f6 !important;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

body.auth-page {
    padding: 20px;
    display: flex;
    justify-content: center; 
    align-items: center;   
    min-height: 100vh; 
    box-sizing: border-box;
}

.auth-container {
    background: var(--bg-card);
    padding: 40px 25px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.auth-container .logo { max-width: 180px; margin-bottom: 20px; }
.auth-container h2 { margin-top: 0; margin-bottom: 8px; color: var(--text-light); font-size: 24px; font-weight: 600; }
.auth-container .sub-text { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

.input-group { position: relative; margin-bottom: 25px; text-align: left; }
.input-group label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.input-group i { position: absolute; left: 15px; bottom: 15px; color: var(--primary-cyan); font-size: 16px; transition: all 0.3s; }
.input-group input {
    width: 100%;
    padding: 14px 15px 14px 45px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--input-color);
    font-size: 15px;
    transition: all 0.3s ease;
}
.input-group input:focus { outline: none; border-color: var(--primary-cyan); background-color: var(--bg-card); box-shadow: 0 0 15px rgba(0, 191, 255, 0.2); }
.input-group input:focus + i { color: var(--primary-cyan); }

.auth-container .btn {
    width: 100%; padding: 15px; border: none; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
    color: #fff; font-size: 16px; font-weight: bold; cursor: pointer;
    transition: all 0.3s ease; margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.4);
}
.auth-container .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 191, 255, 0.6); }

.auth-container .link-text { margin-top: 25px; font-size: 14px; color: var(--text-muted); }
.auth-container .link-text a { color: var(--primary-cyan); text-decoration: none; font-weight: bold; transition: color 0.2s; }
.auth-container .link-text a:hover { color: var(--primary-blue); }

.error-msg, .success-msg {
    padding: 10px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; text-align: center;
}
.error-msg { background-color: rgba(255, 77, 77, 0.2); color: #ff4d4d; border: 1px solid #ff4d4d; }
.success-msg { background-color: rgba(0, 255, 128, 0.2); color: #00ff80; border: 1px solid #00ff80; }

.main-header {
    height: 60px;
    background-color: var(--header-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}
.menu-toggle { font-size: 24px; color: var(--text-light); cursor: pointer; }
.header-right { display: flex; align-items: center; gap: 15px; }
.wallet-box { background-color: rgba(0, 191, 255, 0.1); color: var(--primary-cyan); padding: 5px 12px; border-radius: 20px; border: 1px solid var(--primary-cyan); font-weight: bold; font-size: 14px; }
.profile-icon-header { width: 35px; height: 35px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary-cyan); cursor: pointer; }
.theme-toggle { font-size: 20px; color: var(--text-light); cursor: pointer; }

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    z-index: 2000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}
.sidebar.active { left: 0; }
.sidebar-top { display: flex; justify-content: center; align-items: center; padding: 15px; border-bottom: 1px solid var(--border-color); position: relative; }
.sidebar-top img { height: 40px; }
.close-sidebar { position: absolute; right: 15px; font-size: 22px; color: var(--text-light); cursor: pointer; }
.sidebar-profile { text-align: center; padding: 20px 15px; border-bottom: 1px solid var(--border-color); }
.avatar { width: 70px; height: 70px; border-radius: 50%; background-color: var(--border-color); display: flex; justify-content: center; align-items: center; margin: 0 auto 10px; font-size: 30px; color: var(--primary-cyan); border: 2px solid var(--primary-cyan); overflow: hidden; }
.sidebar-profile h3 { margin: 0 0 5px 0; font-size: 16px; color: var(--text-light); }
.user-badge { background-color: var(--primary-cyan); color: #fff; font-size: 11px; padding: 3px 10px; border-radius: 12px; display: inline-block; }
.menu-category { padding: 15px 15px 5px; font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: bold; letter-spacing: 1px; }

.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-menu li { border-bottom: 1px dashed var(--border-color); }
.sidebar-menu li:last-child { border-bottom: none; }
.sidebar-menu li a { display: flex; align-items: center; padding: 12px 20px; color: var(--text-light); text-decoration: none; font-size: 14px; transition: all 0.2s ease; border-left: 4px solid transparent; }
.sidebar-menu li a i { width: 25px; color: var(--primary-cyan); font-size: 16px; }
.sidebar-menu li a:hover { background-color: rgba(0, 191, 255, 0.1); color: var(--primary-cyan); }
.sidebar-menu li a.active { background-color: var(--primary-blue); border-left: 4px solid var(--primary-cyan); color: #ffffff !important; font-weight: bold; }
.sidebar-menu li a.active i { color: #ffffff !important; }

.sidebar-footer { margin-top: auto; padding: 15px; border-top: 1px solid var(--border-color); }
.logout-btn { display: flex; align-items: center; justify-content: center; width: 100%; padding: 12px; background-color: #ff4d4d; color: #fff; text-decoration: none; border-radius: 8px; font-weight: bold; transition: background 0.2s; }
.logout-btn:hover { background-color: #cc0000; }
.logout-btn i { margin-right: 8px; }

.main-content { padding: 20px; }
.dashboard-wrapper { max-width: 1200px; margin: 0 auto; }
.welcome-banner { background: linear-gradient(90deg, var(--primary-blue), var(--primary-cyan)); color: #fff; padding: 20px; border-radius: 12px; margin-bottom: 25px; box-shadow: 0 5px 15px rgba(0, 191, 255, 0.3); }
.welcome-banner h2 { margin: 0 0 5px 0; color: #fff; font-size: 22px; }
.welcome-banner p { margin: 0; font-size: 14px; opacity: 0.9; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat-card { background-color: var(--bg-card); padding: 20px; border-radius: 12px; border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 10px rgba(0,0,0,0.1); transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-info h4 { margin: 0 0 5px 0; font-size: 13px; color: var(--text-muted); font-weight: normal; }
.stat-info h2 { margin: 0; font-size: 22px; color: var(--text-light); }
.stat-icon { width: 45px; height: 45px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; background-color: rgba(0, 191, 255, 0.1); color: var(--primary-cyan); }

.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-bottom: 25px; }
.action-card { background-color: var(--bg-card); padding: 20px 10px; border-radius: 12px; border: 1px solid var(--border-color); text-align: center; text-decoration: none; color: var(--text-light); transition: all 0.3s; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.action-card:hover { background-color: rgba(0, 191, 255, 0.1); border-color: var(--primary-cyan); transform: translateY(-3px); }
.action-card i { font-size: 28px; color: var(--primary-cyan); margin-bottom: 10px; }
.action-card span { font-size: 14px; font-weight: bold; }

.support-section { background-color: var(--bg-card); padding: 20px; border-radius: 12px; border: 1px solid var(--border-color); }
.support-section h3 { margin: 0 0 15px 0; font-size: 18px; color: var(--text-light); }
.support-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; }
.support-btn { display: flex; align-items: center; justify-content: center; padding: 12px; border-radius: 8px; background-color: rgba(0, 191, 255, 0.1); color: var(--primary-cyan); text-decoration: none; font-weight: bold; border: 1px solid var(--primary-cyan); transition: all 0.2s; }
.support-btn:hover { background-color: var(--primary-cyan); color: #fff; }
.support-btn i { margin-right: 8px; }

.profile-card { background-color: var(--bg-card); padding: 30px; border-radius: 12px; border: 1px solid var(--border-color); max-width: 600px; margin: 0 auto 30px auto; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.profile-header { text-align: center; margin-bottom: 25px; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
.profile-header img { width: 100px; height: 100px; border-radius: 50%; border: 3px solid var(--primary-cyan); margin-bottom: 15px; object-fit: cover; }
.profile-header h3 { margin: 0 0 5px 0; color: var(--text-light); font-size: 20px; }
.profile-header p { margin: 0; color: var(--text-muted); font-size: 14px; }
.profile-form .form-group { margin-bottom: 20px; text-align: left; }
.profile-form label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 14px; }
.profile-form input { width: 100%; padding: 12px 15px; border-radius: 8px; border: 1px solid var(--input-border); background-color: var(--input-bg); color: var(--input-color); font-size: 15px; transition: all 0.3s ease; }
.profile-form input:focus { outline: none; border-color: var(--primary-cyan); box-shadow: 0 0 8px rgba(0, 191, 255, 0.5); }
.profile-form .btn { margin-top: 10px; width: 100%; padding: 12px; border: none; border-radius: 8px; background: linear-gradient(90deg, var(--primary-cyan), var(--primary-blue)); color: #fff; font-size: 16px; font-weight: bold; cursor: pointer; }

.transaction-table-container, .ledger-container { background-color: var(--bg-card); padding: 15px; border-radius: 12px; border: 1px solid var(--border-color); overflow-x: auto; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; min-width: 500px; }
.ledger-table th { text-align: left; padding: 12px 10px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); font-weight: bold; }
.ledger-table th.text-right, .ledger-table td.text-right { text-align: right; }
.ledger-table td { padding: 12px 10px; color: var(--text-light); border-bottom: 1px dashed var(--border-color); }
.ledger-table tr:last-child td { border-bottom: none; }
.text-credit { color: #00ff80; font-weight: bold; }
.text-debit { color: #ff4d4d; font-weight: bold; }
.text-balance { color: var(--primary-cyan); font-weight: bold; }

.badge { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: bold; display: inline-block; }
.badge-pending { background-color: rgba(255, 193, 7, 0.15); color: #ffc107; border: 1px solid #ffc107; }
.badge-success { background-color: rgba(0, 255, 128, 0.15); color: #00ff80; border: 1px solid #00ff80; }
.badge-danger { background-color: rgba(255, 77, 77, 0.15); color: #ff4d4d; border: 1px solid #ff4d4d; }

.api-selector { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.api-option { flex: 1; min-width: 80px; text-align: center; padding: 10px; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--input-bg); cursor: pointer; transition: all 0.2s; position: relative; }
.api-option input[type="radio"] { display: none; }
.api-option.selected { border-color: var(--primary-cyan); background-color: rgba(0, 191, 255, 0.15); box-shadow: 0 0 8px rgba(0, 191, 255, 0.3); }
.api-option label { display: block; cursor: pointer; font-weight: bold; color: var(--text-light); margin-bottom: 5px; }
.api-option .price { font-size: 13px; color: var(--primary-cyan); }

.action-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.btn-action { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: bold; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: all 0.2s; }
.btn-action i { margin-right: 4px; }
.btn-v1, .btn-v2, .btn-v3 { background-color: #d1e7dd; color: #0f5132; border-color: #badbcc; }
.btn-v1:hover, .btn-v2:hover, .btn-v3:hover { background-color: #badbcc; }
.btn-edit { background-color: #cff4fc; color: #055160; border-color: #b6effb; }
.btn-edit:hover { background-color: #b6effb; }
.btn-nid { background-color: #e2d9f3; color: #432874; border-color: #d3c5eb; }
.btn-nid:hover { background-color: #d3c5eb; }
.btn-print { background-color: #28a745; color: #fff; border-color: #1e7e34; }
.btn-print:hover { background-color: #218838; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-grid-2 .form-group, .form-grid-3 .form-group { margin-bottom: 0; }

.upload-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 20px;
    background-color: var(--input-bg);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
    width: 100%;
    min-height: 120px;
    text-align: center;
}
.upload-box:hover { border-color: var(--primary-cyan); background-color: rgba(0, 191, 255, 0.05); }
.upload-box i { font-size: 30px; color: var(--primary-cyan); margin-bottom: 10px; }
.upload-box p { margin: 0; color: var(--text-muted); font-size: 13px; }
.upload-box input[type="file"] { display: none; }

.photo-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }

.charge-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--input-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 20px;
    margin-bottom: 20px;
}
.charge-section h4 { margin: 0; color: var(--text-light); }
.charge-amount { color: #ff8c00; font-weight: bold; font-size: 18px; }

.profile-card input[type="text"],
.profile-card input[type="date"],
.profile-card input[type="file"],
.profile-card select,
.profile-card textarea {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--input-border) !important;
    background-color: var(--input-bg) !important;
    color: var(--input-color) !important;
    font-size: 15px;
    box-sizing: border-box;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}

.profile-card input:focus, .profile-card select:focus, .profile-card textarea:focus {
    border-color: var(--primary-cyan) !important;
    box-shadow: 0 0 8px rgba(0, 191, 255, 0.5);
}

.profile-card select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0b2d1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
}

@media (max-width: 600px) {
    body.auth-page { padding: 15px; }
    .auth-container { padding: 30px 20px; margin: 0 auto; border-radius: 15px; }
    .auth-container .logo { max-width: 150px; }
    .auth-container h2 { font-size: 20px; }
    .input-group { margin-bottom: 20px; }
    .stat-card { flex-direction: column; text-align: center; gap: 10px; }
    .stat-icon { margin-top: 10px; }
    .action-grid { grid-template-columns: repeat(2, 1fr); }
    .support-grid { grid-template-columns: 1fr; }
    .profile-card { padding: 20px 15px; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; gap: 15px; }
    .photo-upload-grid { grid-template-columns: 1fr; }
}

@media (min-width: 992px) {
    #sidebar {
        transform: translateX(0) !important;
        width: 250px !important;
        position: fixed;
        left: 0;
        top: 60px;
        height: calc(100vh - 60px);
        z-index: 1000;
    }
    .main-content {
        margin-left: 250px !important;
        width: calc(100% - 250px) !important;
        padding: 30px !important;
        box-sizing: border-box;
    }
}

/* =========================================
   LIGHT MODE FORCE OVERRIDE (FIXES MUDDY/CLOUDY LOOK)
   ========================================= */

[data-theme="light"] .profile-card,
[data-theme="light"] .auth-container,
[data-theme="light"] .transaction-table-container,
[data-theme="light"] .ledger-container,
[data-theme="light"] .support-section,
[data-theme="light"] .stat-card,
[data-theme="light"] .action-card,
[data-theme="light"] .card,
[data-theme="light"] .modal-content {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #333333 !important;
    border-color: #e0e0e0 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

[data-theme="light"] h1, 
[data-theme="light"] h2, 
[data-theme="light"] h3, 
[data-theme="light"] h4, 
[data-theme="light"] h5, 
[data-theme="light"] h6, 
[data-theme="light"] p, 
[data-theme="light"] span:not(.wallet-box):not(.user-badge), 
[data-theme="light"] label,
[data-theme="light"] .service-info .name {
    color: #333333 !important;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="email"],
[data-theme="light"] select,
[data-theme="light"] textarea {
    background-color: #f9f9f9 !important;
    background: #f9f9f9 !important;
    color: #333333 !important;
    border: 1px solid #cccccc !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: #888888 !important;
    opacity: 1 !important;
}

[data-theme="light"] .upload-box {
    background-color: #f9f9f9 !important;
    border-color: #007bff !important;
}
[data-theme="light"] .upload-box span,
[data-theme="light"] .upload-box i {
    color: #007bff !important;
}

[data-theme="light"] .charge-section {
    background-color: #f0f8ff !important;
    border-color: #b3d4ff !important;
}