/* ==========================================================================
   1. ORIGINAL SITE CONFIGURATION
   ========================================================================== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ==========================================================================
   2. THEME VARIABLES (DARK / LIGHT MODE)
   ========================================================================== */
:root {
    /* Dark mode palette inspired by deep navy + warm coral accents */
    --bg-main: #141522;
    --bg-sidebar: linear-gradient(180deg, #141522 0%, #1b1d2a 100%);
    --bg-header: rgba(20, 21, 34, 0.86);
    --bg-card: #1b1d2a;
    --bg-chat-header: rgba(27, 29, 42, 0.92);
    --bg-chat-footer: rgba(24, 26, 38, 0.95);
    --text-primary: #f8fafc;
    --text-secondary: rgba(248, 250, 252, 0.86);
    --text-muted: rgba(226, 232, 240, 0.68);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(255, 255, 255, 0.16);
    --card-shadow: 0 12px 36px rgba(5, 8, 20, 0.45);
    --chat-bot-bubble: rgba(35, 39, 56, 0.85);
    --chat-bot-text: #e2e8f0;
    --accent-gradient: linear-gradient(135deg, #f27b5b 0%, #e5634a 100%);
    --accent-solid: #e86b4f;
    --accent-solid-hover: #dc5d44;
    --accent-soft: #ffb59f;
    --accent-soft-strong: #ffe2d9;
    --accent-shadow: rgba(242, 123, 91, 0.45);
    --accent-panel-bg: rgba(242, 123, 91, 0.14);
    --accent-panel-border: rgba(255, 177, 150, 0.38);
    --sidebar-nav-text: rgba(255, 244, 240, 0.92);
    --sidebar-nav-active-bg: linear-gradient(135deg, rgba(242, 123, 91, 0.24), rgba(229, 99, 74, 0.2));
    --sidebar-nav-active-text: #fff3ee;
    --sidebar-nav-active-border: rgba(255, 179, 153, 0.44);
}

[data-theme="light"] {
    /* Light mode colors: bright cyan/turquoise accents, white content, dark charcoal text */
    --bg-main: #FFFFFF; /* White main content background */
    --bg-sidebar: linear-gradient(180deg, #22C3EE 0%, #24C2EE 100%); /* Bright cyan/turquoise sidebar */
    --bg-header: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-chat-header: #FFFFFF;
    --bg-chat-footer: #FFFFFF;
    --text-primary: #1E1E1E; /* Dark charcoal for headings & input text */
    --text-secondary: #1E1E1E;
    --text-muted: #6B7280; /* neutral muted text */
    --border-color: #D1D5DB; /* input border */
    --border-highlight: #E5E7EB; /* subtle highlights */
    --card-shadow: 0 8px 25px rgba(14, 20, 24, 0.04);
    --chat-bot-bubble: #F8FAFC;
    --chat-bot-text: #334155;
    --accent-gradient: linear-gradient(90deg, #22C3EE 0%, #24C2EE 100%);
    --accent-solid: #22C3EE; /* accent text like 'forgot password' and 'SIGN-UP' */
    --accent-solid-hover: #0ea5e9;
    --accent-soft: #0f172a;
    --accent-soft-strong: #0b1220;
    --accent-shadow: rgba(56, 189, 248, 0.45);
    --accent-panel-bg: rgba(255, 255, 255, 0.45);
    --accent-panel-border: rgba(255, 255, 255, 0.7);
    --sidebar-nav-text: #0f172a;
    --sidebar-nav-active-bg: rgba(255, 255, 255, 0.35);
    --sidebar-nav-active-text: #0b1220;
    --sidebar-nav-active-border: rgba(255, 255, 255, 0.65);
}

/* ==========================================================================
   3. BASE LAYOUT & SIDEBAR
   ========================================================================== */
.dashboard-body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    transition: width 0.3s ease, background-color 0.3s ease, padding 0.3s ease;
    flex-shrink: 0;
    overflow: hidden;
}

.brand {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-soft);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

    .brand i {
        background: linear-gradient(135deg, var(--accent-soft), var(--accent-solid));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        font-size: 22px;
    }

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
}

    .nav-links li a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        color: var(--sidebar-nav-text);
        text-decoration: none;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        transition: all 0.3s ease;
        cursor: pointer;
        white-space: nowrap;
    }

        .nav-links li.active a, .nav-links li a:hover {
            background: var(--sidebar-nav-active-bg);
            color: var(--sidebar-nav-active-text);
            border: 1px solid var(--sidebar-nav-active-border);
        }

.sidebar.minimized {
    width: 80px;
    padding: 24px 10px;
}

    .sidebar.minimized .brand-text,
    .sidebar.minimized .nav-text,
    .sidebar.minimized .workspace-version {
        display: none;
    }

    .sidebar.minimized .brand {
        justify-content: center;
    }

    .sidebar.minimized .nav-links li a {
        justify-content: center;
        padding: 12px 0;
    }

        .sidebar.minimized .nav-links li a i {
            font-size: 18px;
            margin: 0;
        }

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-main);
    position: relative;
}

.top-header {
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    padding: 18px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 20;
    overflow: visible;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

    .header-left h1 {
        font-size: 18px;
        font-weight: 700;
        color: var(--text-primary);
        margin: 0;
        letter-spacing: -0.3px;
    }

.header-right {
    display: flex;
    align-items: center;
}

.btn-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.3s;
}

    .btn-toggle:hover {
        color: var(--accent-solid);
    }

.profile-section {
    position: relative;
    z-index: 1200;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 6px 10px;
    color: var(--text-primary);
    cursor: pointer;
}

.profile-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 12px;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.1;
}

.profile-name {
    font-size: 12px;
    font-weight: 700;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-type {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-caret {
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.profile-section.open .profile-caret {
    transform: rotate(180deg);
}

.profile-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid var(--border-highlight);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(18px);
    padding: 16px;
    display: none;
    z-index: 2000;
}

[data-theme="light"] .profile-panel {
    background: rgba(255, 255, 255, 0.98);
}

.profile-section.open .profile-panel {
    display: block;
}

.profile-panel-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.profile-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-panel-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.profile-panel-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-soft);
    background: var(--accent-panel-bg);
    border: 1px solid var(--accent-panel-border);
    border-radius: 9px;
    padding: 7px 9px;
}

.profile-panel-link:hover {
    color: var(--accent-soft-strong);
}

.profile-field,
.profile-field-row {
    margin-bottom: 10px;
}

.profile-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.profile-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.profile-field input {
    width: 100%;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 12px;
}

.profile-field input[readonly] {
    opacity: 0.9;
}

.profile-feedback {
    min-height: 18px;
    font-size: 12px;
    margin: 4px 0 8px;
}

.profile-feedback.success {
    color: #22c55e;
}

.profile-feedback.error {
    color: #ef4444;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.profile-save-btn,
.profile-logout-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.profile-save-btn {
    background: var(--accent-gradient);
    color: #fff;
}

.profile-save-btn[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.profile-logout-btn {
    margin-top: 8px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.content-body {
    padding: 32px;
    flex: 1;
}

.footer-custom {
    color: var(--text-muted);
    font-size: 12px;
    padding: 15px 0;
    border-top: 1px solid var(--border-color) !important;
}

/* ==========================================================================
   4. FLOATING CHATBOT WIDGET
   ========================================================================== */
.chatbot-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 10px 25px var(--accent-shadow);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
    touch-action: none;
    user-select: none;
}

    .chatbot-toggle-btn:hover {
        transform: scale(1.08);
        box-shadow: 0 15px 30px var(--accent-shadow);
    }

    .chatbot-toggle-btn.is-dragging {
        cursor: grabbing;
        transform: scale(1.03);
    }

.chat-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    height: min(520px, calc(100vh - 130px));
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-highlight);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    animation: slideUp 0.3s ease forwards;
    min-height: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    background: var(--bg-chat-header);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .chat-header-info i {
        color: var(--accent-solid);
        font-size: 20px;
    }

    .chat-header-info h4 {
        font-size: 14px;
        font-weight: 700;
        color: var(--text-primary);
        margin: 0;
    }

    .chat-header-info p {
        font-size: 11px;
        color: #4ade80;
        margin: 0;
    }

.close-chat {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
}

    .close-chat:hover {
        color: var(--text-primary);
    }

.chat-body {
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

    .chat-body::-webkit-scrollbar {
        width: 8px;
    }

    .chat-body::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.55);
        border-radius: 8px;
    }

.chat-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

    .chat-msg.bot {
        background: var(--chat-bot-bubble);
        color: var(--chat-bot-text);
        align-self: flex-start;
        border: 1px solid var(--border-color);
        border-bottom-left-radius: 2px;
    }

    .chat-msg.user {
        background: var(--accent-gradient);
        color: #fff;
        align-self: flex-end;
        border-bottom-right-radius: 2px;
    }

.chat-footer {
    padding: 14px 16px;
    background: var(--bg-chat-footer);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

    .chat-footer input {
        flex: 1;
        padding: 10px 14px;
        background: rgba(148, 163, 184, 0.05);
        border: 1px solid var(--border-highlight);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 13px;
        outline: none;
        transition: border-color 0.2s;
    }

        .chat-footer input:focus {
            border-color: var(--accent-solid);
        }

    .chat-footer button {
        background: var(--accent-solid);
        color: #fff;
        border: none;
        width: 38px;
        height: 38px;
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        transition: background 0.2s;
    }

        .chat-footer button:hover {
            background: var(--accent-solid-hover);
        }

#voice-chat-btn {
    background: var(--accent-solid);
}

    #voice-chat-btn:hover {
        background: var(--accent-solid-hover);
    }

    #voice-chat-btn.is-listening {
        background: #ef4444;
        animation: pulseMic 1s infinite;
    }

@keyframes pulseMic {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}
