/* Clean Professional Admin Theme */

:root {
    --primary-color: #000000;
    --secondary-color: #666666;
    --accent-color: #007bff;
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --border-color: #dee2e6;
    --text-primary: #212529;
    --text-muted: #6c757d;
    --shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, .075);
    --shadow-md: 0 .5rem 1rem rgba(0, 0, 0, .15);

    /* Toggle Colors */
    --toggle-active: #34C759;
    /* iOS Green */
    --toggle-inactive: #8E8E93;
    /* iOS Grey */
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Typography Overrides */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--accent-color) !important;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

/* Dashboard Specific Cards (Replacing Liquid) */
.dashboard-stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    height: 100%;
    color: var(--text-primary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.dashboard-stat-card .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.dashboard-stat-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

/* Buttons */
.btn {
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #000;
    border-color: #000;
    color: #fff;
}

.btn-primary:hover {
    background-color: #333;
    border-color: #333;
}

.btn-outline-primary {
    color: #000;
    border-color: #000;
}

.btn-outline-primary:hover {
    background-color: #000;
    color: #fff;
}

/* Tables */
.table {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
}

.table thead th {
    background-color: #f1f3f5;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: none;
    padding: 1rem;
}

.table tbody td {
    vertical-align: middle;
    padding: 1rem;
    border-top: 1px solid #f1f3f5;
    color: #212529;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* Forms */
.form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 0.75rem 1rem;
    background-color: #fff;
    color: #212529;
}

.form-control:focus {
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    border-radius: 6px;
    font-weight: 600;
}

.badge-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.badge-danger {
    background-color: #f8d7da;
    color: #842029;
}

.badge-info {
    background-color: #cff4fc;
    color: #055160;
}

/* Utilities */
.shadow-neon {
    box-shadow: none !important;
}

.bg-dark {
    background-color: #212529 !important;
    color: #fff !important;
}

.text-white-50 {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Sidebar specific overrides if needed (handled in main layout inline styles largely) */

/* Light Mode Overrides (Auto-Balance) */
body.light-mode {
    /* User Request: White Background */
    --bg-body: #ffffff;

    /* High Contrast Text (WCAG AAA) */
    --text-primary: #000000;
    /* Pure Black */
    --text-secondary: #333333;
    /* Dark Grey */
    --text-muted: #666666;

    /* White Glass */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.05);

    /* Clearer Shadows for elevation */
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);

    /* User Request: Yellow Buttons */
    --neon-gold: #FFD700;
    /* Standard Gold */
    --neon-blue: #007AFF;
    /* Apple Blue */
    --neon-purple: #AF52DE;

    /* Toggle Colors (same in light mode) */
    --toggle-active: #34C759;
    /* iOS Green */
    --toggle-inactive: #8E8E93;
    /* iOS Grey */
}

/* Light Mode Specific Helpers */
body.light-mode header {
    background: #ffffff !important;
    border-bottom: 1px solid #f0f0f0;
}

/* Logo Styles */

/* Force Black Logo */
body.light-mode .btn-liquid-gold {
    background: #FFD700 !important;
    color: #000000 !important;
    box-shadow: none;
}

/* Global Reset */
body {
    background: var(--bg-body);
    transition: background 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: var(--lh-standard);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Dark Mode Background Gradient (Only in Dark Mode) */
body:not(.light-mode) {
    background-image:
        radial-gradient(circle at 50% 0%, #1a1a2e 0%, transparent 60%),
        radial-gradient(circle at 85% 30%, rgba(188, 19, 254, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 15% 70%, rgba(0, 242, 255, 0.05) 0%, transparent 40%);
}

/* Typography Auto-Balance */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-primary) !important;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: var(--lh-tight);
}

h1 {
    font-size: var(--fs-h1);
}

h2 {
    font-size: var(--fs-h2);
}

h3 {
    font-size: var(--fs-h3);
}

h4 {
    font-size: var(--fs-h4);
}

h5 {
    font-size: var(--fs-h5);
}

p,
span,
label,
div {
    font-family: var(--font-body);
    color: var(--text-secondary);
}

label {
    font-size: var(--fs-label);
    font-weight: 500;
    margin-bottom: 8px;
}

small,
.small {
    font-size: var(--fs-small) !important;
    line-height: 1.4;
}

.text-white {
    color: var(--text-primary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Neon Helper Classes */
.text-neon-blue {
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

body.light-mode .text-neon-blue {
    text-shadow: none;
    font-weight: 600;
}

/* Remove glow in light mode for readability */

.text-neon-gold {
    color: var(--neon-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

body.light-mode .text-neon-gold {
    text-shadow: none;
    font-weight: 600;
}


/* Header */
header {
    background: #ffffff !important;
    /* Force White Globally */
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    /* Subtle border instead of glass border */
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background 0.3s;
}

body.light-mode header {
    background: #ffffff !important;
    border-bottom: 1px solid #f0f0f0;
}

body.light-mode .navbar-brand img {
    /* filter: invert(1) brightness(0); REMOVED: Keep Original Logo Colors */
    filter: none;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
}

/* Glass Cards */
.liquid-card-dashboard {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
}

.liquid-card-dashboard:active {
    transform: scale(0.98);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
    margin-top: 10px;
}

/* Action Buttons */
.btn-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 140px;
    text-decoration: none !important;
    box-shadow: var(--card-shadow);
    transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-card:hover {
    transform: translateY(-4px);
    border-color: var(--neon-blue);
}

.btn-card h5 {
    margin-top: 12px;
    font-size: 0.95rem;
    color: var(--text-primary);
}


/* Inputs (iOS Style) */
.ios-input-group {
    border-bottom: 1px solid var(--glass-border);
    padding: 12px 0;
    display: flex;
    align-items: center;
}

.ios-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    padding-left: 15px;
    font-size: 1rem;
}

.ios-input:focus {
    outline: none;
}

.ios-label {
    width: 30px;
    text-align: center;
    color: var(--text-muted);
}


/* Toggles */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--glass-border);
}

.toggle-row:last-child {
    border-bottom: none;
}

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

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-inactive);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--toggle-active);
}

input:checked+.slider:before {
    transform: translateX(20px);
}


/* Theme Switcher Widget */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    background: rgba(120, 120, 128, 0.2);
    border-radius: 20px;
    padding: 2px;
    position: relative;
    width: 64px;
    height: 32px;
    cursor: pointer;
}

.theme-switch-check {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 28px;
    height: 28px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.theme-icon-sun {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #FDB931;
    z-index: 1;
}

.theme-icon-moon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #bdc3c7;
    z-index: 1;
}

.theme-switch-check:checked+.theme-switch-slider {
    transform: translateX(32px);
    background-color: #3b3b3b;
}


/* Footer */
.footer-glass {
    position: fixed;
    bottom: 25px;
    left: 25px;
    right: 25px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 15px 20px;
    box-shadow: var(--card-shadow);
    z-index: 100;
}

.footer-icon-box {
    text-align: center;
    color: var(--text-muted);
    text-decoration: none !important;
    transition: 0.3s;
}

.footer-icon-box.active {
    color: var(--neon-blue);
    transform: scale(1.1);
}

.footer-icon-box i {
    font-size: 1.4rem;
    display: block;
    margin-bottom: 2px;
}

.footer-icon-box span {
    font-size: 0.7rem;
    font-weight: 500;
}


/* Modals */
.modal-content {
    background: var(--bg-body);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--glass-border);
}

.close {
    color: var(--text-primary);
    opacity: 0.8;
}

.modal-backdrop {
    z-index: 10000 !important;
}

.modal {
    z-index: 10001 !important;
}

/* .modal-open .main { filter: blur(5px); } REMOVED: Blurs modals inside main */

/* Theme Aware Input */
.input-neomorphic {
    background: #2c2c2e;
    border: none;
    color: white !important;
    border-radius: 10px;
    padding: 10px 15px;
}

body.light-mode .input-neomorphic {
    background: #f1f2f6;
    color: #333 !important;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05);
}

.input-group-text {
    border-color: transparent !important;
}

body.light-mode .input-group-text {
    background: #e5e7eb !important;
    color: #333 !important;
}

/* Misc */
.btn-circle-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34C759, #30B753);
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(52, 199, 89, 0.4);
    transition: transform 0.2s;
}

.btn-circle-icon:active {
    transform: scale(0.9);
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FDB931);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: black;
    font-size: 1.2rem;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Light Mode Refinements */
body.light-mode .chart-container canvas {
    filter: invert(0);
}

/* Ensure canvas isn't inverted if we handle colors in JS */
body.light-mode .text-neon-blue {
    color: #0284c7 !important;
    text-shadow: none;
}

body.light-mode .text-neon-gold {
    color: #d97706 !important;
    text-shadow: none;
}

body.light-mode .footer-icon-box {
    color: #6b7280;
}

body.light-mode .footer-icon-box.active {
    color: #007AFF;
    transform: scale(1.1);
    font-weight: 600;
}

body.light-mode .btn-card img {
    mix-blend-mode: normal !important;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Logo Filters Removed */

/* Invert white logo to black */
/* Liquid Gold Button */
.btn-liquid-gold {
    background: #FFD700;
    color: #000000 !important;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transition: 0.3s;
}

/* Glass Badge (Wallet, etc.) */
.glass-badge {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    border-radius: 50px;
    padding: 8px 16px;
    transition: 0.3s;
}

body.light-mode .glass-badge {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
}

body.light-mode .glass-badge svg {
    stroke: #333;
    /* Make icon dark in light mode */
}

body.light-mode .glass-badge .text-neon-gold {
    color: #d97706 !important;
    /* Keep gold accent visibile */
    stroke: #d97706 !important;
}

/* SOS Icon */
.sos-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ff3b30;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.light-mode .sos-icon {
    border: none;
    box-shadow: 0 2px 5px rgba(255, 59, 48, 0.3);
}

/* Toast Notifications */
.custom-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 280px;
    max-width: 400px;
}

.custom-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.custom-toast .toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

.custom-toast.toast-success .toast-icon {
    background: #34C759;
    color: white;
}

.custom-toast.toast-error .toast-icon {
    background: #FF3B30;
    color: white;
}

.custom-toast .toast-message {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

body.light-mode .custom-toast {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .custom-toast {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
}