/* ============================================================
   Mikrofy ISP Cloud - Theme System
   Default: Dark mode (html.dark)
   Alternative: Light mode (html.light)
   ============================================================ */

/* ---- Toggle Button Styling ---- */
.mikrofy-theme-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: #fbbf24;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
    outline: none;
}

.mikrofy-theme-toggle:hover {
    transform: scale(1.12);
    background: rgba(255, 255, 255, 0.15);
}

.mikrofy-theme-toggle:active {
    transform: scale(0.95);
}

html.light .mikrofy-theme-toggle {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #6366f1;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

html.light .mikrofy-theme-toggle:hover {
    background: #f8fafc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ---- Smooth Transitions (enabled after initial paint) ---- */
html.mikrofy-theme-transitions body,
html.mikrofy-theme-transitions aside,
html.mikrofy-theme-transitions nav,
html.mikrofy-theme-transitions .glass-panel,
html.mikrofy-theme-transitions .glass-input,
html.mikrofy-theme-transitions .card,
html.mikrofy-theme-transitions .plan-card {
    transition: background-color 0.25s ease, color 0.2s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}


/* ============================================================
   LIGHT MODE OVERRIDES
   ============================================================ */

/* ---- Body / Page Backgrounds ---- */
html.light body {
    background: #f1f5f9 !important;
    background-image: none !important;
    color: #334155 !important;
}

/* ---- Tailwind bg-dark-* Overrides ---- */
html.light .bg-dark-900 {
    background-color: #ffffff !important;
}

html.light .bg-dark-800 {
    background-color: #f8fafc !important;
}

html.light .bg-dark-900\/95 {
    background-color: rgba(255, 255, 255, 0.95) !important;
}

html.light .bg-dark-900\/80 {
    background-color: rgba(255, 255, 255, 0.92) !important;
}

/* ---- Tailwind bg-slate-* Overrides ---- */
html.light .bg-slate-950 {
    background-color: #ffffff !important;
}

html.light .bg-slate-900 {
    background-color: #f8fafc !important;
}

html.light .bg-slate-800 {
    background-color: #f1f5f9 !important;
}

html.light .bg-slate-700 {
    background-color: #e2e8f0 !important;
}

/* ---- White-alpha backgrounds (dark theme glass effects) → subtle gray ---- */
html.light .bg-white\/5 {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

html.light .bg-white\/10 {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

html.light .bg-white\/20 {
    background-color: rgba(0, 0, 0, 0.06) !important;
}

html.light .bg-black\/40 {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

/* Backdrop overlay stays dark in light mode */
html.light .bg-black\/60 {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* ---- Hover background overrides ---- */
html.light .hover\:bg-white\/5:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

html.light .hover\:bg-white\/10:hover {
    background-color: rgba(0, 0, 0, 0.06) !important;
}

html.light .hover\:bg-white\/20:hover {
    background-color: rgba(0, 0, 0, 0.08) !important;
}

/* ---- Text Color Overrides ---- */
html.light .text-white {
    color: #1e293b !important;
}

html.light .text-gray-50 {
    color: #1e293b !important;
}

html.light .text-slate-50 {
    color: #1e293b !important;
}

html.light .text-slate-200 {
    color: #475569 !important;
}

html.light .text-slate-300 {
    color: #64748b !important;
}

html.light .text-slate-400 {
    color: #64748b !important;
}

html.light .text-slate-500 {
    color: #94a3b8 !important;
}

html.light .text-slate-600 {
    color: #94a3b8 !important;
}

html.light .text-slate-700 {
    color: #94a3b8 !important;
}

html.light .text-dark-700 {
    color: #64748b !important;
}

/* Hover text overrides */
html.light .hover\:text-white:hover {
    color: #0f172a !important;
}

html.light .hover\:text-slate-300:hover {
    color: #475569 !important;
}

/* ---- Border Color Overrides ---- */
html.light .border-white\/5 {
    border-color: #e2e8f0 !important;
}

html.light .border-white\/10 {
    border-color: #e2e8f0 !important;
}

html.light .border-slate-800 {
    border-color: #e2e8f0 !important;
}

html.light .border-slate-700 {
    border-color: #cbd5e1 !important;
}

/* ---- Divide Color Overrides ---- */
html.light .divide-white\/5 > :not([hidden]) ~ :not([hidden]) {
    border-color: #e2e8f0 !important;
}

/* ---- Placeholder Color Overrides ---- */
html.light .placeholder\:text-slate-600::placeholder {
    color: #94a3b8 !important;
}

html.light .placeholder\:text-dark-700::placeholder {
    color: #94a3b8 !important;
}

/* ---- Shadow Overrides ---- */
html.light .shadow-brand-500\/20 {
    --tw-shadow-color: rgba(0, 237, 100, 0.08) !important;
}

/* ---- Ring Offsets ---- */
html.light .focus\:ring-offset-2:focus {
    --tw-ring-offset-color: #ffffff !important;
}


/* ============================================================
   CUSTOM COMPONENT OVERRIDES (Light Mode)
   ============================================================ */

/* ---- Glass Panel (landing, admin auth login) ---- */
html.light .glass-panel {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: blur(16px);
}

/* ---- Glass Input ---- */
html.light .glass-input {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}

html.light .glass-input:focus {
    border-color: var(--brand-color, #00ED64) !important;
    box-shadow: 0 0 0 2px rgba(var(--r, 0), var(--g, 237), var(--b, 100), 0.15) !important;
}

html.light .glass-input::placeholder {
    color: #94a3b8 !important;
}

/* ---- Plan Cards (landing page) ---- */
html.light .plan-card {
    background: #ffffff !important;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06) !important;
    border-color: #e2e8f0 !important;
}

html.light .plan-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1) !important;
    border-color: var(--brand-color, #00ED64) !important;
}

/* ---- Card (payment_wait, error, bridge pages) ---- */
html.light .card {
    background: rgba(255, 255, 255, 0.97) !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

html.light .card h2 {
    color: #1e293b !important;
}

html.light .card p {
    color: #64748b !important;
}

html.light .card .phone {
    color: #059669 !important;
}

html.light .card .btn {
    background: #e2e8f0 !important;
    color: #334155 !important;
}

html.light .card .btn:hover {
    background: #cbd5e1 !important;
}

html.light .card .btn-primary {
    background: #3b82f6 !important;
    color: #ffffff !important;
}

html.light .card .btn-primary:hover {
    background: #2563eb !important;
}

html.light .card .error-code {
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
}

/* ---- Spinner (payment wait, bridge) ---- */
html.light .spinner {
    border-color: rgba(0, 0, 0, 0.08) !important;
    border-left-color: #10b981 !important;
}

/* ---- Error Icon ---- */
html.light .error-icon {
    background: #fef2f2 !important;
    color: #ef4444;
}

/* ---- Status message ---- */
html.light #status-message {
    color: #d97706 !important;
}


/* ============================================================
   SIDEBAR OVERRIDES (Admin Dashboard)
   ============================================================ */

html.light aside {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Active sidebar item */
html.light .bg-brand-500\/10 {
    background-color: rgba(0, 237, 100, 0.06) !important;
}

html.light .text-brand-50 {
    color: #065f46 !important;
}

html.light .text-brand-100 {
    color: #047857 !important;
}

/* ---- Sidebar scrollbar ---- */
html.light aside::-webkit-scrollbar-track {
    background: #f8fafc;
}

html.light aside::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}


/* ============================================================
   NAVBAR OVERRIDES
   ============================================================ */

html.light nav {
    background-color: rgba(255, 255, 255, 0.92) !important;
    border-color: #e2e8f0 !important;
    backdrop-filter: blur(12px);
}

html.light .glass-nav {
    background: rgba(255, 255, 255, 0.92) !important;
    border-color: #e2e8f0 !important;
}

/* ---- Home Page Hero ---- */
html.light .hero-glow {
    background: radial-gradient(circle at 50% 0%, rgba(0, 237, 100, 0.08) 0%, transparent 60%) !important;
}

html.light .feature-pill:hover {
    background-color: rgba(0, 237, 100, 0.06) !important;
}

html.light .feature-pill.active {
    background-color: rgba(0, 237, 100, 0.08) !important;
    border-color: rgba(0, 237, 100, 0.3) !important;
}


/* ============================================================
   FORM ELEMENTS IN LIGHT MODE
   ============================================================ */

/* Dark-themed inputs used in admin dashboard */
html.light input.bg-dark-900,
html.light select.bg-dark-900,
html.light textarea.bg-dark-900 {
    background-color: #f8fafc !important;
    color: #1e293b !important;
    border-color: #e2e8f0 !important;
}

html.light input.bg-dark-800,
html.light select.bg-dark-800,
html.light textarea.bg-dark-800 {
    background-color: #f8fafc !important;
    color: #1e293b !important;
    border-color: #e2e8f0 !important;
}

/* Checkbox styled for admin */
html.light input[type="checkbox"].bg-dark-800 {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
}


/* ============================================================
   TABLE OVERRIDES (Admin Dashboard)
   ============================================================ */

html.light table {
    color: #334155;
}

html.light thead {
    background-color: #f8fafc !important;
}

html.light th {
    color: #64748b !important;
    border-color: #e2e8f0 !important;
}

html.light td {
    border-color: #f1f5f9 !important;
}

html.light tr:hover {
    background-color: rgba(0, 0, 0, 0.02) !important;
}


/* ============================================================
   MODAL OVERRIDES
   ============================================================ */

/* Modals with dark backgrounds */
html.light .bg-dark-900[class*="rounded"],
html.light div.bg-dark-900 {
    background-color: #ffffff !important;
}

html.light div.bg-dark-800 {
    background-color: #f8fafc !important;
}


/* ============================================================
   TOAST / NOTIFICATION OVERRIDES
   ============================================================ */

html.light .bg-emerald-500\/20 {
    background-color: rgba(16, 185, 129, 0.08) !important;
}

html.light .bg-red-500\/20 {
    background-color: rgba(239, 68, 68, 0.08) !important;
}

html.light .bg-red-500\/10 {
    background-color: rgba(239, 68, 68, 0.05) !important;
}

html.light .border-red-500\/20 {
    border-color: rgba(239, 68, 68, 0.15) !important;
}

html.light .border-red-500\/50 {
    border-color: rgba(239, 68, 68, 0.2) !important;
}

html.light .text-red-200 {
    color: #dc2626 !important;
}

html.light .text-red-400 {
    color: #dc2626 !important;
}


/* ============================================================
   CHART CONTAINER OVERRIDES
   ============================================================ */

html.light canvas {
    filter: none;
}


/* ============================================================
   SCROLLBAR (Global)
   ============================================================ */

html.light ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

html.light ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

html.light ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

html.light ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* ============================================================
   DEV BUTTONS (payment wait page)
   ============================================================ */

html.light .dev-btn {
    border-color: #e2e8f0 !important;
}

html.light .btn-secondary {
    background: #e2e8f0 !important;
    color: #334155 !important;
}


/* ============================================================
   MISC OVERRIDES
   ============================================================ */

/* Selection color in light mode */
html.light ::selection {
    background: rgba(0, 237, 100, 0.15);
    color: #1e293b;
}

/* Focus rings */
html.light .focus\:ring-brand-500:focus {
    --tw-ring-color: rgba(0, 237, 100, 0.4);
}

/* Badge / pill backgrounds */
html.light .bg-brand-50 {
    background-color: #ecfdf5 !important;
}

/* Code / Debug sections */
html.light .font-mono {
    color: #475569;
}

html.light pre {
    background-color: #f8fafc !important;
    color: #334155 !important;
    border-color: #e2e8f0 !important;
}


/* ============================================================
   DARK MODE FOR LIGHT-FIRST PAGES
   (payment/required, etc.)
   Scoped to pages using .page-light-first on body to avoid
   breaking light elements inside dark-first pages.
   Add class="page-light-first" to the body of light-first pages.
   ============================================================ */

html.dark .page-light-first {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

html.dark .page-light-first .bg-white {
    background-color: #1e293b !important;
}

html.dark .page-light-first .bg-gray-100 {
    background-color: #0f172a !important;
}

html.dark .page-light-first .bg-gray-50 {
    background-color: #1e293b !important;
}

html.dark .page-light-first .text-gray-800 {
    color: #e2e8f0 !important;
}

html.dark .page-light-first .text-gray-700 {
    color: #cbd5e1 !important;
}

html.dark .page-light-first .text-gray-600 {
    color: #94a3b8 !important;
}

html.dark .page-light-first .text-gray-500 {
    color: #94a3b8 !important;
}

html.dark .page-light-first .text-gray-900 {
    color: #f1f5f9 !important;
}

html.dark .page-light-first .border-gray-200 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html.dark .page-light-first .border-gray-300 {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html.dark .page-light-first .bg-blue-100 {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

html.dark .page-light-first .border-blue-400 {
    border-color: rgba(59, 130, 246, 0.3) !important;
}

html.dark .page-light-first .text-blue-700 {
    color: #93c5fd !important;
}

html.dark .page-light-first .bg-red-100 {
    background-color: rgba(239, 68, 68, 0.15) !important;
}

html.dark .page-light-first .border-red-400 {
    border-color: rgba(239, 68, 68, 0.3) !important;
}

html.dark .page-light-first .text-red-700 {
    color: #fca5a5 !important;
}

html.dark .page-light-first input {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html.dark .page-light-first .shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4) !important;
}
