/* Xformance Modern CRM Theme */
:root {
    --primary-color: #0d6efd;
    --dark-sidebar: #1e293b;
    --active-nav: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
    background-color: #f8fafc;
    overflow-x: hidden;
}

#wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    overflow-x: hidden;
}

/* Sidebar General */
.sidebar {
    background-color: var(--dark-sidebar) !important;
}

.sidebar .list-group-item {
    border: none;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    border-radius: 0.375rem;
    margin: 0.1rem 0.5rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

.sidebar .active-nav {
    background-color: var(--active-nav) !important;
    font-weight: 600;
    color: #fff !important;
}

/* Sidebar on Mobile (< 768px): Drawer / Off-canvas */
@media (max-width: 767.98px) {
    #sidebar-wrapper {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100%;
        z-index: 1055;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    }

    body.sidebar-open #sidebar-wrapper {
        transform: translateX(0);
    }

    #sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(3px);
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.28s ease, visibility 0.28s ease;
    }

    body.sidebar-open #sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    #page-content-wrapper {
        min-width: 0;
        width: 100%;
    }
}

/* Sidebar on Desktop (>= 768px) */
@media (min-width: 768px) {
    #sidebar-wrapper {
        width: 260px;
        min-width: 260px;
        flex-shrink: 0;
        position: relative;
        min-height: 100vh;
        overflow: visible;
        z-index: 10;
        display: flex;
        flex-direction: column;
    }

    #sidebar-backdrop {
        display: none !important;
    }

    #page-content-wrapper {
        min-width: 0;
        flex: 1;
        width: calc(100% - 260px);
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
}

/* Card & UI Polish */
.card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.badge {
    font-weight: 500;
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.table td {
    font-size: 0.9rem;
}

/* Table Responsive Scrolling on Mobile */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    position: relative;
}

/* Ensure data tables don't get squished */
.table-data {
    min-width: 720px;
}

/* Complex form items table (orders, completions) */
.table-items {
    min-width: 820px;
}

/* Touch-friendly inputs & buttons on Mobile */
@media (max-width: 767.98px) {
    /* Prevent iOS zoom on input focus */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select.form-select,
    textarea.form-control {
        font-size: 16px !important;
    }

    .btn {
        min-height: 38px;
    }

    .btn-group-sm > .btn {
        min-height: 34px;
        padding-left: 0.55rem;
        padding-right: 0.55rem;
    }

    /* Scroll hint alert for tables */
    .mobile-scroll-hint {
        display: block !important;
    }
}

.mobile-scroll-hint {
    display: none;
    font-size: 0.75rem;
    color: #64748b;
}
