﻿/* ================= GLOBAL ================= */

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    background-color: #f8f9fa;
    /* 🔥 IMPORTANT FIXES */
    height: 100%;
    margin: 0;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior-y: contain;
}

body {
    scroll-behavior: smooth;
    overflow-x: hidden;
    min-height: 100vh;
}

a, .btn-link {
    color: #006bb7;
}

.page-title {
    font-weight: 600;
    margin-bottom: 20px;
}

.content-area {
    padding: 20px;
}

label {
    font-size: 13px;
    margin-bottom: 2px;
}

/* ================= LAYOUT ================= */

.layout-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.topbar {
    background: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
}

/* ================= SIDEBAR ================= */

.sidebar-container {
    position: sticky;
    top: 0;
    width: 240px;
    height: 100vh;
    padding: 15px 10px;
    background: #0f172a;
    overflow-y: auto;
}

    .sidebar-container::-webkit-scrollbar {
        width: 5px;
    }

    .sidebar-container::-webkit-scrollbar-thumb {
        background: #2c3e50;
        border-radius: 10px;
    }

.nav-section {
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    margin: 18px 0 8px 12px;
    text-transform: uppercase;
}

.sidebar-link {
    color: #fff !important;
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.25s;
}

    .sidebar-link:hover {
        background: #1f1f1f;
        transform: translateX(5px);
    }

    .sidebar-link.active {
        background: #0d6efd !important;
    }

/* ================= BUTTONS ================= */

.btn {
    border-radius: 10px;
    transition: 0.2s;
}

    .btn:hover {
        transform: translateY(-1px);
    }

.btn-primary {
    background: #1b6ec2;
    border-color: #1861ac;
    box-shadow: 0 3px 8px rgba(13,110,253,0.3);
}

    .btn-primary:hover {
        box-shadow: 0 5px 14px rgba(13,110,253,0.4);
    }

.btn-equal {
    height: 45px;
    font-weight: 500;
}

/* ================= CARDS ================= */

.card {
    border: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    transition: 0.2s;
    overflow: visible; /* 🔥 ADD THIS */
}

    .card:hover {
        transform: translateY(-3px);
    }

.dashboard-card::before {
    content: "";
    position: absolute;
    width: 6px;
    height: 100%;
    left: 0;
    top: 0;
}

.card-info::before {
    background: #0dcaf0;
}

.card-success::before {
    background: #198754;
}

.card-warning::before {
    background: #ffc107;
}

.card-danger::before {
    background: #dc3545;
}

/* ================= TABLE ================= */

.table th {
    font-weight: 600;
}

.table td {
    vertical-align: middle;
}

.table-responsive {
    overflow: visible !important;
}

.dropdown-menu {
    z-index: 9999 !important;
}

/* ================= STATUS ================= */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

    .status-badge .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }

.status-in {
    background: #d4edda;
    color: #155724;
}

.status-out {
    background: #f8d7da;
    color: #721c24;
}

.status-break {
    background: #fff3cd;
    color: #856404;
}

.status-default {
    background: #e2e3e5;
    color: #383d41;
}

/* ================= TOAST ================= */

.toast-box {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 18px;
    border-radius: 12px;
    color: #fff;
    z-index: 9999;
}

.toast-success {
    background: #16a34a;
}

.toast-error {
    background: #dc2626;
}

.toast-warning {
    background: #f59e0b;
}

/* ================= UTIL ================= */

.text-nowrap {
    white-space: nowrap;
}

.used-row {
    background: #f5f5f5;
    opacity: 0.75;
}

/* ================= DASHBOARD ================= */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.card-box {
    padding: 18px;
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

    .card-box h3 {
        font-size: 26px;
        margin: 0;
    }

/* Colors */
.green {
    background: #22c55e;
}

.red {
    background: #ef4444;
}

.orange {
    background: #f59e0b;
}

.purple {
    background: #8b5cf6;
}

.blue {
    background: #3b82f6;
}

/* ================= MOBILE ================= */

@media (max-width: 768px) {

    html, body {
        height: 100%;
        overflow: hidden;
    }

    .layout-wrapper {
        flex-direction: column;
        height: 100dvh;
        overflow: hidden;
    }

    .main-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .content-area {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 12px;
        padding-bottom: 100px;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-container {
        width: 100%;
        height: auto;
        position: relative;
    }

    table {
        min-width: 600px;
    }

    .btn {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}

.dropdown-item span {
    background-color: #ffe58f;
    padding: 0 2px;
}

.card.border-danger {
    border: 1px solid red !important;
}

/* SAFE AREA FIX */
.mobile-safe-area {
    padding-bottom: 120px;
}

/* ADD BUTTON */
.d-block.d-md-none .btn-primary {
    border-radius: 12px;
    height: 48px;
    font-size: 16px;
}

.card.mb-2 {
    border-radius: 12px;
    transition: 0.15s;
}

    .card.mb-2:active {
        transform: scale(0.99);
    }

.form-control {
    font-size: 14px;
    padding: 6px 8px;
}

.btn-success {
    box-shadow: 0 3px 10px rgba(25,135,84,0.3);
}

.btn-danger {
    box-shadow: 0 3px 10px rgba(220,53,69,0.3);
}

.d-block.d-md-none .btn-outline-primary {
    height: 44px;
    border-radius: 10px;
    font-weight: 500;
}

.mobile-action-bar {
    display: flex;
    gap: 8px;
    padding: 10px;
}

    .mobile-action-bar .action-btn {
        flex: 1; /* equal width */
        height: 48px;
        font-size: 16px;
        border-radius: 10px;
    }

/* 🔥 Fix dropdown text visibility */
.autocomplete .dropdown-menu {
    background-color: #ffffff;
    color: #212529;
}

.autocomplete .dropdown-item {
    color: #212529 !important; /* force dark text */
}

    /* Active (selected row) */
    .autocomplete .dropdown-item.active {
        background-color: #4f46e5;
        color: #ffffff !important;
    }

    /* Hover */
    .autocomplete .dropdown-item:hover {
        background-color: #eef2ff;
        color: #212529 !important;
    }

/* Secondary line (city/mobile) */
.autocomplete .text-muted {
    color: #6c757d !important;
}

/* 🔥 Highlight fix inside active row */
.autocomplete .dropdown-item.active mark {
    background-color: #fde047;
    color: #000;
}

mark {
    background-color: #ffe066;
    padding: 0 2px;
    border-radius: 2px;
}

/* 🔥 Fix secondary text inside active item */
.autocomplete .dropdown-item.active .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Optional: slightly brighter */
.autocomplete .dropdown-item.active .small {
    color: rgba(255, 255, 255, 0.9) !important;
}