/* assets/css/style.css */

/* Modern Fonts & Global Tokens */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0f172a; /* Deep Slate/Navy */
    --accent-color: #10b981;  /* Emerald Green */
    --info-color: #0284c7;    /* Bright Blue */
    --bg-light: #f8fafc;      /* Subtle Cool Grey */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 8px -1px rgba(15, 23, 42, 0.04);
    --hover-shadow: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    color: #334155;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Quick Actions Dashboard Grid */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.15rem 0.85rem;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
    height: 100%;
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.08);
    border-color: #2563eb;
    color: #2563eb;
}

.quick-action-btn i {
    font-size: 1.6rem;
    margin-bottom: 0.6rem;
    transition: transform 0.2s ease;
}

.quick-action-btn:hover i {
    transform: scale(1.1);
}

.quick-action-btn.btn-res { color: #2563eb; }
.quick-action-btn.btn-res:hover { background-color: #f0f6ff; }

.quick-action-btn.btn-pay { color: #10b981; }
.quick-action-btn.btn-pay:hover { background-color: #ecfdf5; }

.quick-action-btn.btn-exp { color: #ef4444; }
.quick-action-btn.btn-exp:hover { background-color: #fef2f2; }

.quick-action-btn.btn-cli { color: #0284c7; }
.quick-action-btn.btn-cli:hover { background-color: #f0f9ff; }

.quick-action-btn.btn-apt { color: #7c3aed; }
.quick-action-btn.btn-apt:hover { background-color: #f5f3ff; }

.quick-action-btn.btn-clean { color: #f59e0b; }
.quick-action-btn.btn-clean:hover { background-color: #fffbeb; }

.quick-action-btn.btn-rec { color: #0d9488; }
.quick-action-btn.btn-rec:hover { background-color: #f0fdfa; }

/* Layout Wrapper */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling */
#sidebar-container {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

#sidebar-container .sidebar-heading {
    padding: 1.5rem 1.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#sidebar-container .list-group {
    padding: 1rem 0.75rem;
}

#sidebar-container .list-group-item {
    border: none;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#sidebar-container .list-group-item i {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

#sidebar-container .list-group-item:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

#sidebar-container .list-group-item:hover i {
    transform: translateX(3px);
}

#sidebar-container .list-group-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

/* Main Content Area */
#page-content-wrapper {
    flex-grow: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Header/Navbar */
.navbar-custom {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.85rem 1.5rem;
}

/* Premium Dashboard Cards */
.stat-card {
    background: #ffffff;
    border: none;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--info-color);
}

.stat-card.accent::before {
    background: var(--accent-color);
}

.stat-card.warning::before {
    background: #f59e0b;
}

.stat-card.danger::before {
    background: #ef4444;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Content Container */
.main-container {
    padding: 2rem;
    flex-grow: 1;
}

/* Badges custom */
.badge-custom {
    padding: 0.45em 0.75em;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 6px;
}

.table-responsive-custom {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table-custom th {
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #f1f5f9;
    padding: 1rem 0.75rem;
}

.table-custom td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.filter-card {
    background: #ffffff;
    border: none;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Detail Profile Cover */
.profile-cover {
    height: 200px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px 16px 0 0;
    position: relative;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border: 1px solid #cbd5e1;
    font-weight: 500;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    border-color: #2563eb;
}

.btn-custom {
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
}

/* Image gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/3;
    box-shadow: var(--card-shadow);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 0.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-actions {
    opacity: 1;
}

/* Sidebar Toggle Mechanics (Desktop Only) */
@media (min-width: 992px) {
    body.sidebar-collapsed #sidebar-container {
        min-width: var(--sidebar-collapsed-width);
        max-width: var(--sidebar-collapsed-width);
    }
    
    body.sidebar-collapsed #sidebar-container .sidebar-heading span {
        display: none;
    }
    
    body.sidebar-collapsed #sidebar-container .list-group-item span {
        display: none;
    }
    
    body.sidebar-collapsed #sidebar-container .list-group-item {
        justify-content: center;
        padding: 0.85rem;
    }
    
    body.sidebar-collapsed #page-content-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }
}

/* Sidebar Overlay for modern backdrop blurring */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-mobile-active .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Bottom Navigation Bar (iOS / Android Premium Layout) */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 66px;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px -2px rgba(15, 23, 42, 0.08) !important;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    height: 100%;
}

.mobile-nav-link i {
    font-size: 1.35rem;
    margin-bottom: 2px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-link:hover, .mobile-nav-link:focus {
    color: var(--primary-color);
}

.mobile-nav-link.active {
    color: #2563eb;
}

.mobile-nav-link.active i {
    transform: translateY(-2px);
    color: #2563eb;
}

/* Responsive elements */
@media (max-width: 991.98px) {
    body {
        padding-bottom: 75px !important; /* space for the mobile bottom nav */
    }

    #sidebar-container {
        margin-left: 0 !important;
        left: -260px;
        top: 0;
        height: 100vh;
        min-width: 0 !important;
        max-width: 0 !important;
        width: 0 !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        z-index: 1060; /* render above overlay */
    }
    
    body.sidebar-mobile-active #sidebar-container {
        left: 0;
        min-width: 260px !important;
        max-width: 260px !important;
        width: 260px !important;
    }
    
    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    body.sidebar-mobile-active {
        overflow: hidden;
    }
}

@media (max-width: 575.98px) {
    .main-container {
        padding: 1rem !important;
    }
    
    .table-responsive-custom {
        padding: 0.85rem !important;
        border-radius: 12px !important;
    }
    
    /* Optimize stat cards spacing to avoid text overlap on mobile */
    .stat-card {
        padding: 0.85rem !important;
    }
    
    .stat-card-icon {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.15rem !important;
    }
    
    .stat-card h3 {
        font-size: 1.25rem !important;
    }
    
    .stat-card span {
        font-size: 0.7rem !important;
    }
    
    /* Prevent title overlap by stacking vertically dynamically */
    .main-container > .d-flex.justify-content-between.align-items-center,
    .main-container > div > .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.85rem !important;
    }
    
    .main-container > .d-flex.justify-content-between.align-items-center > a.btn,
    .main-container > div > .d-flex.justify-content-between.align-items-center > a.btn,
    .main-container > .d-flex.justify-content-between.align-items-center > button,
    .main-container > div > .d-flex.justify-content-between.align-items-center > button {
        width: 100% !important;
        text-align: center;
    }
}

/* PRINTING MEDIA STYLES (A4) */
@media print {
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 12pt;
    }
    
    #sidebar-container, 
    .navbar-custom, 
    .btn, 
    footer, 
    .filter-card,
    .no-print {
        display: none !important;
    }
    
    #page-content-wrapper {
        margin-left: 0 !important;
    }
    
    .main-container {
        padding: 0 !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .print-a4-page {
        width: 100%;
        max-width: 800px;
        margin: 0 auto;
        padding: 20px;
        background: #ffffff;
    }
}
