/* css/dark-mode.css - Final Clean Version (Global) */

/* =========================================
   1. Global Reset & Base
   ========================================= */
body.dark-mode {
    background-color: #0f172a !important; /* Slate 900 */
    color: #f1f5f9 !important;
}

/* Force all typography to light color */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode p,
body.dark-mode span,
body.dark-mode div,
body.dark-mode li,
body.dark-mode label,
body.dark-mode strong,
body.dark-mode b,
body.dark-mode td,
body.dark-mode th,
body.dark-mode .text-dark,
body.dark-mode .fw-bold {
    color: #f1f5f9 !important;
}

body.dark-mode .text-muted {
    color: #94a3b8 !important;
}

body.dark-mode .text-primary {
    color: #38bdf8 !important;
}

body.dark-mode .text-danger {
    color: #f87171 !important;
}

body.dark-mode .text-success {
    color: #4ade80 !important;
}

body.dark-mode .small {
    color: #cbd5e1 !important;
}

/* =========================================
   2. Sidebar 
   ========================================= */
body.dark-mode #sidebar-wrapper {
    background-color: #020617 !important; /* Slate 950 */
    border-right: 1px solid #1e293b !important; /* Changed to border-right for LTR */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5) !important;
}

/* Brand Text Fix */
body.dark-mode .sidebar-heading .brand-text,
body.dark-mode .sidebar-heading span {
    color: #ffffff !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.15) !important;
    font-weight: bold !important;
}

body.dark-mode .sidebar-heading img {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

body.dark-mode .sidebar-heading {
    border-bottom: 1px solid #1e293b !important;
    background-color: transparent !important;
}

/* Sidebar Nav Items */
body.dark-mode .mobile-nav-item {
    color: #94a3b8 !important;
    transition: all 0.3s ease;
}

body.dark-mode .mobile-nav-item:hover,
body.dark-mode .mobile-nav-item.active {
    background-color: rgba(56, 189, 248, 0.1) !important;
    color: #38bdf8 !important;
    border-left: 3px solid #38bdf8 !important; /* Changed to border-left for LTR */
}

/* Admin Panel Bottom Section */
body.dark-mode .mt-auto.p-3 {
    border-top: 1px solid #1e293b !important;
    background-color: #020617 !important;
}

/* =========================================
   3. UI Components (Cards, Modals, Lines)
   ========================================= */
body.dark-mode .modern-card,
body.dark-mode .project-card,
body.dark-mode .stat-card-simple,
body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .dropdown-menu,
body.dark-mode .list-group-item,
body.dark-mode .bg-white,
body.dark-mode .bg-light,
body.dark-mode .shadow-sm {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
    box-shadow: none !important;
}

body.dark-mode .border,
body.dark-mode .border-top,
body.dark-mode .border-bottom {
    border-color: #334155 !important;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* =========================================
   4. Forms & Inputs
   ========================================= */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .form-check-input {
    background-color: #0f172a !important;
    border: 1px solid #475569 !important;
    color: #fff !important;
}

body.dark-mode input::placeholder {
    color: #64748b !important;
}

body.dark-mode .input-group-text {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #fff !important;
}

/* Buttons */
body.dark-mode .btn-white,
body.dark-mode .btn-light {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #fff !important;
}

body.dark-mode .btn-white:hover {
    background-color: #334155 !important;
}

/* =========================================
   5. Data Tables
   ========================================= */
body.dark-mode .table-responsive {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
}

body.dark-mode .table {
    --bs-table-bg: transparent !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-mode .table thead th {
    background-color: #0f172a !important;
    color: #38bdf8 !important;
    border-bottom: 2px solid #334155 !important;
}

body.dark-mode .table tbody td {
    background-color: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
}

body.dark-mode .table-hover tbody tr:hover td {
    background-color: #334155 !important;
}

body.dark-mode .column-search {
    background-color: #0f172a !important;
    color: #fff !important;
    border: 1px solid #475569 !important;
}

/* =========================================
   6. Form Builder
   ========================================= */
body.dark-mode #form-canvas {
    background-color: #0f172a !important;
    border: 2px dashed #475569 !important;
}

body.dark-mode #empty-msg i {
    opacity: 0.3 !important;
    color: #fff !important;
}

body.dark-mode .toolbox-item {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .toolbox-item:hover {
    background-color: #334155 !important;
    border-color: #38bdf8 !important;
    color: #fff !important;
}

body.dark-mode .toolbox-item i {
    color: #38bdf8 !important;
}

body.dark-mode .form-field,
body.dark-mode .form-element {
    background-color: #1e293b !important;
    border: 1px solid #475569 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
    margin-bottom: 15px !important;
}

body.dark-mode .editable-label {
    background-color: transparent !important;
    color: #38bdf8 !important;
    border-bottom: 1px dashed #475569 !important;
}

body.dark-mode .option-tag {
    background-color: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}

body.dark-mode .condition-zone {
    background-color: rgba(56, 189, 248, 0.05) !important;
    border: 1px dashed #334155 !important;
}

/* =========================================
   7. Main Page & Alerts
   ========================================= */
body.dark-mode .btn-view-data-footer {
    background-color: #0f172a !important;
    color: #38bdf8 !important;
    border-top: 1px solid #334155 !important;
}

body.dark-mode .btn-view-data-footer:hover {
    background-color: #020617 !important;
}

body.dark-mode .btn-design-outline {
    background-color: transparent !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}

body.dark-mode div.swal2-popup {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
}

/* =========================================
   8. View.html Page
   ========================================= */
body.dark-mode .form-body {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5) !important;
}

/* Form Header */
body.dark-mode .modern-header {
    background-color: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
}

body.dark-mode .header-icon-box {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #38bdf8 !important;
}

/* Form Title & Subtitle */
body.dark-mode #formTitleDisplay,
body.dark-mode h1.modern-title {
    color: #ffffff !important;
    text-shadow: none !important;
}

body.dark-mode .modern-subtitle {
    color: #94a3b8 !important;
    border-color: #334155 !important;
    opacity: 1 !important;
}

/* Signature & Submit */
body.dark-mode canvas {
    filter: invert(1) hue-rotate(180deg);
    background-color: #fff !important;
}

body.dark-mode .btn-submit {
    background-color: #38bdf8 !important;
    color: #0f172a !important;
    font-weight: bold !important;
}

body.dark-mode .opacity-50 {
    opacity: 0.3 !important;
    color: #64748b !important;
}

/* =========================================
   9. Global Brand Force
   ========================================= */
body.dark-mode #sidebar-wrapper .sidebar-heading * {
    color: #ffffff !important;
    fill: #ffffff !important;
}

body.dark-mode .brand-text {
    color: #ffffff !important;
}

body.dark-mode a.sidebar-heading {
    color: #ffffff !important;
}

/* =========================================
   10. Smart Mobile Switching
   ========================================= */
@media (max-width: 768px) {

    /* Light Mode */
    #sidebar-wrapper .brand-text {
        color: #0f172a !important;
        -webkit-text-fill-color: #0f172a !important;
        text-shadow: none !important;
    }

    /* Dark Mode */
    body.dark-mode #sidebar-wrapper .brand-text {
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.4) !important;
    }
}

/* =========================================
   ELEGANT DARK MODE (Dynamic Colors)
   ========================================= */
body.dark-mode .project-card-elegant {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-top: 4px solid var(--card-color) !important;
    /* Keep the colorful top line */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2) !important;
}

body.dark-mode .project-card-elegant:hover {
    border-color: var(--card-color) !important;
    /* Full border color on hover */
    box-shadow: 0 10px 20px -5px var(--card-color) !important;
    /* Glowing shadow based on project color */
}

/* Icon matching project color */
body.dark-mode .elegant-icon {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: var(--card-color) !important;
}

/* Texts */
body.dark-mode .elegant-title {
    color: #f8fafc !important;
}

body.dark-mode .elegant-date {
    color: #94a3b8 !important;
}

/* Main button adapts to project color in dark mode */
body.dark-mode .fill-btn {
    background-color: var(--card-color) !important;
    border-color: var(--card-color) !important;
    color: #0f172a !important;
    /* Dark text for better contrast on bright colors */
}

body.dark-mode .fill-btn:hover {
    filter: brightness(1.2) !important;
}

/* Data Button */
body.dark-mode .data-btn {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

body.dark-mode .data-btn:hover {
    background: #334155 !important;
    color: #fff !important;
}

/* Bottom Actions */
body.dark-mode .elegant-actions-secondary {
    border-top-color: #334155 !important;
}

body.dark-mode .elegant-btn-icon {
    color: #cbd5e1 !important;
}

body.dark-mode .elegant-btn-icon:hover {
    background: #334155 !important;
    color: #fff !important;
    border-color: #475569 !important;
}

body.dark-mode .elegant-btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

/* Status Badges */
body.dark-mode .elegant-status.active {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #34d399 !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
}

body.dark-mode .elegant-status.paused {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

/* =========================================
   Branches UI Dark Mode
   ========================================= */
body.dark-mode .branch-group {
    background-color: #1e293b !important; /* Suitable dark background for cards */
    border-color: #38bdf8 !important; /* Changed border color to light blue */
}

body.dark-mode .branch-header {
    color: #38bdf8 !important; /* Changed text color to light blue for readability */
}