﻿/* --- Layout Wrapping ---------------------------------------------------- */
html, body {
    margin: 0;
    padding: 0;    
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    height: 100%;
}

.input-validation-error {
    border: 1px solid #dc3545;
    background-color: #fff5f5;
}

.field-validation-error {
    color: #dc3545;
}

.page-title {
    margin-bottom: 25px;
}

    .page-title h1 {
        margin: 0;
    }

.subtitle {
    color: var(--text-muted);
}


.layout-wrapper {    
    display: flex;
    height: 100vh;
    background: var(--bg);
    color: var(--text);
    
}

.layout-wrapper,
.content {
    max-width: 100%;
    overflow: hidden;
}

:root {
    --bg: #ffffff;
    --text: #222;
    --card-bg: #f3f3f3;
    --sidebar-bg: #1f2937;
    --sidebar-text: #e5e7eb;
    --sidebar-hover: #374151;
    --accent: #3b82f6;
}

.dark {
    --bg: #111827;
    --text: #e5e7eb;
    --card-bg: #1f2937;
    --sidebar-bg: #111827;
    --sidebar-hover: #1f2937;
}

/* ----------- LOGIN PAGE ------------- */

.login-container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    padding: 20px;
}

/* Prevent child elements from exceeding viewport */
* {
    box-sizing: border-box;
}

html.dark .login-container {
    background: #181a1e;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--card-bg, #ffffff);
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    animation: slideIn .5s ease;
}

.login-card h2 {
    margin: 0;
    font-size: 1.8rem;
    text-align: center;
}

.pane-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.03);
    min-height: 100%;
}

.note-card,
.task-card {
    border: 1px solid #ececec;
    background: #fafafa;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}

.action-scroll {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.login-card .subtitle {
    margin: 5px 0 20px;
    text-align: center;
    font-size: .9rem;
    opacity: .7;
}

.crm-panel {
    background: white;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(0,0,0,0.03);
}

.lead-actions-panel {
    position: sticky;
    top: 85px;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
}


h4 {
    color: #1f2937;
}

.container-fluid {
    max-width: 1400px;
}

.row {
    display: flex !important;
    flex-wrap: wrap !important;
}
@media(max-width: 991px) {
    .lead-actions-panel {
        position: static;
    }
}
form label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #bbb;
    border-radius: 6px;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
}

.form-remember {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.form-remember {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
    gap: 6px;
}

.btn-login {
    width: 100%;
    text-align: center;
    font-weight: bold;
}

/* Animated Button */
button, .btn-login, .btn-primary {
    width: 100%;
    padding: 10px 0;
    border: none;
    background: #4a90e2;
    color: white;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: .25s;
}

    button:hover,
    .btn-login:hover,
    .btn-primary:hover {
        background: #3379c7;
        transform: translateY(-2px);
    }

.text-danger {
    font-size: 12px;
    color: red;
}
/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   TABLES
========================================================= */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

tr:nth-child(even) {
    background: #f7f7f7;
}

/* Dark mode adjustments */
html.dark table tr:nth-child(even) {
    background: #2a2a2a;
}


/* --- Sidebar ------------------------------------------------------------ */
.sidebar {
    padding-top: 55px;
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width .3s ease;
    overflow-x: visible; /* ✅ Important */
    overflow-y: auto; /* ✅ Important */
    position: relative; /* ✅ Important */
}

    .sidebar.collapsed {
        width: 70px;
    }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    font-size: 1.3rem;
}

.sidebar-title {
    opacity: 1;
    transition: opacity .3s;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.3rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background .2s, padding-left .2s;
}

    .menu-item:hover {
        background: var(--sidebar-hover);
        padding-left: 24px;
    }

.sidebar.collapsed .menu-item span {
    display: none;
}

/* --- ADMIN DROPDOWN FIX ---- */

.sidebar .dropdown-menu {
    position: relative !important;
    transform: none !important;
    float: none;
    width: 100%;
    background: #1f2937;
    border-radius: 12px;
    margin: 6px 0 10px 0;
    padding: 6px;
    border: 1px solid #374151;
    box-shadow: none;
    display: block;
    z-index: 9999 !important;
}

    .sidebar .dropdown-menu.show {
        display: block;
    }

.sidebar .dropdown-item {
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
}

    .sidebar .dropdown-item:hover {
        background: #4f46e5;        
    }

.sidebar .dropdown-toggle::after {
    float: right;
    margin-top: 7px;
}


.menu-bottom {
    margin-top: auto;
    /*margin-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 10px;*/
}

/* --- Main Content -------------------------------------------------------- */
.content {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg);
}

/* --- Dashboard ----------------------------------------------------------- */
.dashboard {
    text-align: center;
}
.dashboard-card {
    cursor: pointer;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.dashboard-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 6px #00000020;
    transition: transform .3s, box-shadow .3s;
}

    .dashboard-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 4px 12px #00000040;
    }

    .dashboard-card i {
        font-size: 2rem;
        color: var(--accent);
        margin-bottom: 12px;
    }
    .dashboard-card h3 {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .dashboard-card .count {
        font-size: 32px;
        font-weight: bold;
        margin: 10px 0;
    }

/* --- Animations ---------------------------------------------------------- */
.fade-in {
    animation: fade .6s ease forwards;
    opacity: 0;
}

.fade-in-delayed {
    animation: fade .8s ease forwards;
    opacity: 0;
}

.fade-in-delayed-2 {
    animation: fade 1s ease forwards;
    opacity: 0;
}

.btn-dashboard {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    text-decoration: none;
}


.section-title h2 {
    margin-top: 30px;
    margin-bottom: 10px;
}

.dashboard-table {
    background: var(--bg-lighter);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.qa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.qa-btn {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 8px;
    font-size: 1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
}

    .qa-btn i {
        font-size: 24px;
        color: var(--primary);
    }



@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* --- Responsive sidebar -------------------------------------------------- */
@media(max-width: 768px) {
    .sidebar {
        width: 200px;
    }
}

@media(max-width: 580px) {
    .layout-wrapper {
        flex-direction: column;
    }

    .layout-wrapper {
        flex-direction: column;
    }

    .content {
        padding: 15px;
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        z-index: 999;
        height: 100vh;
        transform: translateX(-260px);
    }

        .sidebar.open {
            transform: translateX(0);
        }

    #sidebarToggle {
        display: block;
    }
    
    /* Dark Mode */
    :root.dark .login-card {
        background: #1e1e1e;
        color: #fff;
    }    
}

/* Force readable text in toastr */
#toast-container > div {
    opacity: 1 !important;
}
#toast-container .toast,
#toast-container .toast-message,
#toast-container .toast-title {
    color: white !important;
}

/* Optional: better background contrast */
.toast-success {
    background-color: #198754 !important; /* Bootstrap green */
}

.toast-error {
    background-color: #dc3545 !important; /* Bootstrap red */
}

.toast-warning {
    background-color: #ffc107 !important; /* Bootstrap yellow */
}

.toast-info {
    background-color: #0dcaf0 !important; /* Bootstrap blue */
}

/* Make toast box relative */
#toast-container .toast {
    position: relative !important; /* ensures absolute child positioning */
    padding-right: 35px !important; /* reserve space for close button */
}

    /* Position the close button inside the top-right corner */
    #toast-container .toast .toast-close-button {
        position: absolute !important;
        top: 8px !important; /* distance from top of toast box */
        right: 8px !important; /* distance from right edge of toast box */
        color: white !important; /* make it visible */
        opacity: 1 !important;
        font-size: 16px !important;
        line-height: 1 !important;
        text-align: center !important;
    }

/* ================= MOBILE HAMBURGER NAV ================= */

/* Mobile top bar */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 12px 16px;
    z-index: 1001;    
    align-items: center;
    justify-content: flex-start; /* 🔥 THIS FIXES CENTERING */
    gap: 75%;
}

/* Hamburger button */
#mobileMenuBtn {
    font-size: 22px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Improve sidebar animation */
.sidebar {
    transition: transform 0.3s ease, width 0.3s ease;
}

/* ===== MOBILE BEHAVIOR ===== */
@media (max-width: 900px) {

    /* Show top bar */
    .mobile-topbar {
        display: flex;
    }

    /* Push content down below top bar */
    .content {
        margin-top: 55px;
    }

    /* Sidebar becomes overlay */
    .sidebar {
        position: fixed;
        top: 55px;
        left: 0;
        height: calc(100% - 55px);
        width: 260px;
        transform: translateX(-100%);
        z-index: 1000;
    }

        /* When open */
        .sidebar.open {
            transform: translateX(0) !important;
        }

    /* Prevent full width sidebar on small screens */
    @media (max-width: 580px) {
        .sidebar {
            width: 240px;
        }
    }
}

/* Hide cards on desktop */
.mobile-cards {
    display: none;
}

/* Card styling */
.lead-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.task-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.overdue {
    border-left: 5px solid red;
}

.card-header {
    font-size: 18px;
    margin-bottom: 8px;
}

.card-body p {
    margin: 4px 0;
}

.card-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

/* 🔥 Mobile switch */
@media (max-width: 768px) {

    .desktop-table {
        display: none;
    }

    .mobile-cards {
        display: block;
    }
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 15px;
}

    .pagination .page-link {
        padding: 6px 12px;
        border: 1px solid #ccc;
        border-radius: 6px;
        text-decoration: none;
        color: #333;
        background-color: #fff;
        font-size: 14px;
    }

        .pagination .page-link:hover {
            background-color: #f0f0f0;
        }

        .pagination .page-link.active {
            background-color: #007bff;
            color: #fff;
            border-color: #007bff;
        }

@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
    }

        .pagination .page-link {
            padding: 5px 8px;
            font-size: 12px;
        }
}

/* Default (desktop) */
.add-lead-btn .plus-icon {
    margin-right: 6px;
}

/* Mobile */
@media (max-width: 768px) {

   /* .add-lead-btn .btn-text {
        display: none;
    }*/

    .btn-text {
        display: none;
    }
    .add-lead-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        padding: 0;
        z-index: 1000;
    }
}




