/* ============================================
   LOVEWORLD ERP - COMPLETE STYLE.CSS
   Comprehensive sidebar styling with mobile support
   ============================================ */

/* ============================================
   SIDEBAR LAYOUT
   ============================================ */
#sidebarWrap {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--surface, #1e293b) !important;
    border-right: 1px solid var(--border, #334155);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar for Sidebar */
#sidebarWrap::-webkit-scrollbar {
    width: 6px;
}

#sidebarWrap::-webkit-scrollbar-track {
    background: var(--surface, #1e293b);
}

#sidebarWrap::-webkit-scrollbar-thumb {
    background: var(--border, #334155);
    border-radius: 3px;
}

#sidebarWrap::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #94a3b8);
}

/* ============================================
   LOGO SECTION
   ============================================ */
.logoRow {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border, #334155);
    background: var(--surface, #1e293b);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logoRow img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.logoRow .h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text, #f1f5f9);
    margin: 0;
}

.logoRow .caption {
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
}

/* ============================================
   SEARCH BOX
   ============================================ */
.search {
    padding: 15px 20px;
    position: relative;
    background: var(--surface, #1e293b);
    border-bottom: 1px solid var(--border, #334155);
    position: sticky;
    top: 81px;
    z-index: 9;
}

.search input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    background: var(--bg, #0f172a);
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    color: var(--text, #f1f5f9);
    font-size: 14px;
}

.search input::placeholder {
    color: var(--text-muted, #94a3b8);
}

.search input:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
}

.search i {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #94a3b8);
    pointer-events: none;
}

/* ============================================
   SIDEBAR CONTENT
   ============================================ */
#sidebar {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

/* ============================================
   GROUPS & SECTIONS
   ============================================ */
.group {
    margin-bottom: 24px;
}

.group .title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============================================
   ACCORDION SYSTEM
   ============================================ */
.acc {
    margin-bottom: 4px;
}

.acc .head {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
}

.acc .head:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary, #3b82f6);
}

.acc .head i:first-child {
    width: 20px;
    text-align: center;
}

.acc .head .caret {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* Accordion Open State */
.acc.open .head {
    color: var(--primary, #3b82f6);
}

.acc.open .head .caret {
    transform: rotate(90deg);
}

/* Accordion Body */
.acc .body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(15, 23, 42, 0.5);
}

.acc.open .body {
    max-height: 1000px; /* Large enough for content */
}

/* ============================================
   LINKS
   ============================================ */
.acc .body .link {
    display: block;
    padding: 10px 20px 10px 52px;
    color: var(--text-muted, #94a3b8);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.acc .body .link:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary, #3b82f6);
    border-left-color: var(--primary, #3b82f6);
}

.acc .body .link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary, #3b82f6);
    border-left-color: var(--primary, #3b82f6);
    font-weight: 500;
}

/* ============================================
   MAIN CONTENT AREA - FIX GAP ISSUE
   ============================================ */
main {
    margin-left: 280px;
    margin-top: 0;
    padding: 20px;
    min-height: 100vh;
    width: calc(100% - 280px);
}

/* Header Bar (if you have one) */
header {
    position: sticky;
    top: 0;
    left: 280px;
    right: 0;
    height: auto;
    background: var(--surface, #1e293b);
    border-bottom: 1px solid var(--border, #334155);
    padding: 20px;
    z-index: 100;
    margin-left: 280px;
    width: calc(100% - 280px);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    #sidebarWrap {
        position: fixed !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
        background: var(--surface, #1e293b) !important;
        z-index: 999 !important;
    }
    
    #sidebarWrap.open {
        transform: translateX(0);
    }
    
    main {
        margin-left: 0;
        width: 100%;
        padding: 80px 15px 15px 15px;
    }
    
    header {
        margin-left: 0;
        width: 100%;
        left: 0;
        padding-top: 70px;
    }
}

/* ============================================
   FORM ELEMENTS - REINFORCE FIXES
   ============================================ */
select,
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="tel"],
input[type="url"],
textarea {
    background: var(--surface, #1e293b) !important;
    color: var(--text, #f1f5f9) !important;
    border: 1px solid var(--border, #334155) !important;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 40px !important;
}

select option {
    background: var(--surface, #1e293b) !important;
    color: var(--text, #f1f5f9) !important;
    padding: 10px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary, #3b82f6) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted, #94a3b8);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--surface, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 12px;
    margin-bottom: 20px;
}

.card .hd {
    padding: 20px;
    border-bottom: 1px solid var(--border, #334155);
    background: var(--bg, #0f172a);
}

.card .bd {
    padding: 20px;
}

.card .ft {
    padding: 15px 20px;
    border-top: 1px solid var(--border, #334155);
    background: var(--bg, #0f172a);
}

/* ============================================
   TABLES
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--bg, #0f172a);
}

.table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text, #f1f5f9);
    border-bottom: 2px solid var(--border, #334155);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border, #334155);
    color: var(--text, #f1f5f9);
}

.table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.table td {
    color: var(--text) !important;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn.primary {
    background: var(--primary, #3b82f6);
    color: white;
}

.btn.primary:hover {
    background: #2563eb;
}

.btn.success {
    background: var(--success, #22c55e);
    color: white;
}

.btn.ghost {
    background: transparent;
    color: var(--text, #f1f5f9);
    border: 1px solid var(--border, #334155);
}

.btn.ghost:hover {
    background: var(--surface, #1e293b);
}

/* ============================================
   GRID SYSTEM
   ============================================ */
.grid {
    display: grid;
    gap: 20px;
}

.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 1024px) {
    .grid.cols-4, .grid.cols-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success, #22c55e);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger, #ef4444);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning, #f59e0b);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.h1, .h2, .h3, .h4 {
    color: var(--text, #f1f5f9);
    font-weight: 600;
    margin-bottom: 15px;
}

.h1 { font-size: 32px; }
.h2 { font-size: 24px; }
.h3 { font-size: 20px; }
.h4 { font-size: 18px; }

.caption {
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }