/* ===================================
   Admin Panel CSS - Bootstrap 5 Native
   Custom minimal hanya untuk Sidebar
   =================================== */

/* ===================================
   1. CSS VARIABLES
   =================================== */
:root {
    --sidebar-width: 280px;
    --header-height: 60px;
}

/* ===================================
   2. SIDEBAR CUSTOM (Positioning Only)
   =================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: #2c3e50;
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease-in-out;
}

/* Custom Scrollbar untuk Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Sidebar Sticky */
.sidebar-sticky {
    position: relative;
    padding-bottom: 80px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-header a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ecf0f1;
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.sidebar-header a:hover {
    color: #ffffff;
    transform: translateX(4px);
}

.sidebar-header i {
    font-size: 24px;
}

/* Sidebar Navigation menggunakan Bootstrap classes */
.sidebar .nav-item {
    margin: 2px 8px;
}

.sidebar .nav-link {
    color: #ecf0f1;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    /* Touch friendly minimum size */
    min-height: 42px;
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background-color: #3498db;
    color: #ffffff;
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
}

/* Chevron rotation untuk collapse */
.sidebar .nav-link .fa-chevron-down {
    transition: transform 0.3s ease;
}

.sidebar .nav-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

/* Submenu styling */
.sidebar .collapse .nav-link {
    padding-left: 3.25rem;
    font-size: 14px;
    font-weight: 400;
}

.sidebar .collapse .nav-link.active {
    background: rgba(52, 152, 219, 0.3);
    border-left: 3px solid #3498db;
}

/* Nav section title */
.nav-section-title small {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* ===================================
   3. HEADER (Menggunakan Bootstrap)
   =================================== */
.admin-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    z-index: 1020;
}

.admin-header .navbar {
    height: 100%;
}


/* ===================================
   4. MAIN CONTENT (Menggunakan Bootstrap)
   =================================== */
.main-content {
    min-height: 100vh;
    padding-top: var(--header-height);
    padding-left: var(--sidebar-width);
}

/* ===================================
   5. UTILITIES & OVERRIDES
   =================================== */

/* Text truncate utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Quick access badge */
.quick-access-item .badge {
    font-size: 0.65rem;
}

/* ===================================
   6. PRINT STYLES
   =================================== */
@media print {
    .sidebar,
    .admin-header {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
    }
}

/* ===================================
   7. ACCESSIBILITY
   =================================== */
*:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   8. MOBILE RESPONSIVE
   =================================== */

/* Hamburger Toggle Button */
.hamburger-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #2c3e50;
    border-radius: 6px;
}

.hamburger-toggle:hover {
    background: rgba(44, 62, 80, 0.1);
}

.hamburger-toggle i {
    font-size: 20px;
}

/* Mobile Styles */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 260px;
        --header-height: 56px;
    }

    /* Show hamburger button */
    .hamburger-toggle {
        display: block !important;
    }

    /* Sidebar - Hidden by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    /* Sidebar - Show when active */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 1045;
        animation: fadeIn 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    /* Header - Full width */
    .admin-header {
        left: 0;
        right: 0;
    }

    /* Main content - Full width */
    .main-content {
        padding-left: 0;
        padding-top: 56px;
    }
    
    .main-content > .container-fluid {
        padding-top: 0 !important;
    }

    /* Sidebar header - Smaller */
    .sidebar-header {
        padding: 15px 12px;
    }

    .sidebar-header a {
        font-size: 18px;
    }

    .sidebar-header i {
        font-size: 20px;
    }

    /* Nav items - Smaller */
    .sidebar .nav-link {
        padding: 10px 12px;
        font-size: 14px;
    }

    .sidebar .collapse .nav-link {
        padding: 8px 12px 8px 2.5rem;
        font-size: 13px;
    }

    /* Quick access items - Smaller */
    .nav-section-title small {
        font-size: 0.7rem !important;
        padding: 8px 12px !important;
    }

    .quick-access-item .badge {
        font-size: 0.6rem !important;
    }

    /* Header adjustments */
    .admin-header .navbar {
        padding: 0.5rem 1rem;
    }

    .admin-header h1 {
        font-size: 1.1rem;
    }

    /* User profile - Compact */
    .admin-header .nav-link img {
        width: 32px;
        height: 32px;
    }
    
    .admin-header .fa-user-circle {
        font-size: 1.8rem;
    }

    
    /* Header Dropdown Fix untuk Mobile */
    .navbar .dropdown-menu {
        position: absolute !important;
        top: 100% !important;
        right: 0 !important;
        left: auto !important;
        margin-top: 0.5rem;
        min-width: 200px;
        max-width: 280px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-radius: 8px;
        border: 1px solid #e0e0e0;
        z-index: 1050;
    }
    
    .navbar .dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
    }
    
    .navbar .nav-item.dropdown {
        position: relative;
    }
    
    .navbar .dropdown-menu .dropdown-item {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .navbar .dropdown-menu .dropdown-item i {
        width: 20px;
        text-align: center;
    }
    
    /* Fix admin header z-index */
    .admin-header {
        position: sticky;
        top: 0;
        z-index: 1040;
        background: white;
    }
}

/* Tablet devices (Portrait) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Header title can be slightly larger */
    .admin-header h1 {
        font-size: 1.2rem !important;
    }

    /* Show username on tablets */
    .admin-header .nav-link span {
        display: inline !important;
    }

    /* Sidebar slightly wider */
    .sidebar {
        width: 280px;
    }

    /* Better spacing for nav items */
    .sidebar .nav-link {
        padding: 12px 14px;
        font-size: 14.5px;
    }
}

/* Extra small devices */
@media (max-width: 575.98px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 52px;
    }

    /* Sidebar full width on extra small screens */
    .sidebar {
        width: 280px;
    }

    /* Even smaller text */
    .sidebar .nav-link {
        padding: 8px 10px;
        font-size: 13px;
    }

    .sidebar .collapse .nav-link {
        padding: 6px 10px 6px 2.25rem;
        font-size: 12px;
    }

    .sidebar-header a {
        font-size: 16px;
    }

    /* Header compact for small screens */
    .admin-header .navbar {
        padding: 0.5rem;
    }
    
    .admin-header h1 {
        font-size: 1rem;
    }

    .hamburger-toggle i {
        font-size: 18px;
    }

    .admin-header .nav-link img {
        width: 28px;
        height: 28px;
    }
    
    .admin-header .fa-user-circle {
        font-size: 1.5rem;
    }

    /* User dropdown - Adjusted */
    .dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
        min-width: 180px;
        font-size: 0.9rem;
    }

    /* Main content padding */
    .main-content .container-fluid {
        padding: 0.75rem;
    }

    /* Alert messages - Smaller */
    .alert {
        font-size: 0.85rem;
        padding: 10px 12px;
    }

    .alert h6 {
        font-size: 0.9rem;
    }

    /* System messages - Compact */
    .system-messages .alert i {
        font-size: 1rem !important;
    }
    
    /* Global Notification Container - Mobile */
    #globalNotificationContainer {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .global-notification-content {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .global-notification-icon {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
    
    .global-notification-message {
        font-size: 13px;
    }
    
    .global-notification-close {
        font-size: 12px;
    }
    
    /* Header Dropdowns - Extra Small */
    .navbar .dropdown-menu {
        min-width: 180px;
        max-width: 240px;
    }
    
    .navbar .dropdown-menu .dropdown-item {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
    
    
    /* Dropdown Animation for Mobile */
    .navbar .dropdown-menu.show {
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Fix dropdown positioning on mobile */
    .navbar .dropdown {
        position: static;
    }
    
    .navbar .dropdown-menu {
        position: absolute !important;
    }
    
    .admin-header .navbar {
        padding: 0.5rem 0.75rem;
    }
    
    /* Global Notification - Mobile */
    #globalNotificationContainer {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .global-notification {
        margin-bottom: 8px;
    }
    
    .global-notification-content {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .global-notification-icon {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .global-notification-message {
        font-size: 13px;
    }
}

/* ============================================
   GLOBAL NOTIFICATION SYSTEM
   ============================================ */
#globalNotificationContainer {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

.global-notification {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    margin-bottom: 12px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    overflow: hidden;
    border-left: 4px solid;
}

.global-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.global-notification.hide {
    opacity: 0;
    transform: translateX(400px);
}

.global-notification-success {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #ffffff 0%, #f0fff4 100%);
}

.global-notification-error {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
}

.global-notification-warning {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #ffffff 0%, #fffbf0 100%);
}

.global-notification-info {
    border-left-color: #17a2b8;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}

.global-notification-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.global-notification-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
}

.global-notification-success .global-notification-icon {
    background: #28a745;
    color: white;
}

.global-notification-error .global-notification-icon {
    background: #dc3545;
    color: white;
}

.global-notification-warning .global-notification-icon {
    background: #ffc107;
    color: #856404;
}

.global-notification-info .global-notification-icon {
    background: #17a2b8;
    color: white;
}

.global-notification-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.5;
}

.global-notification-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #6c757d;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.global-notification-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #495057;
}
