/**
 * Universal Sidebar Navigation Styles
 * TendPOS Admin Portal
 */

/* ==========================================
   LAYOUT STRUCTURE
   ========================================== */

.has-admin-sidebar {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f7fafc;
}

/* ==========================================
   TOP HEADER
   ========================================== */

.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #2d3748;
    border-bottom: 1px solid #4a5568;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 1.5rem;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
}

.header-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 0.75rem;
    color: #a0aec0;
    margin: 0;
    line-height: 1.2;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: #fc8181;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(252, 129, 129, 0.1);
    color: #f56565;
}

/* ==========================================
   SIDEBAR
   ========================================== */

.admin-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 260px;
    height: calc(100vh - 64px);
    background: #2d3748;
    border-right: 1px solid #4a5568;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.admin-sidebar.collapsed {
    width: 70px;
}

.admin-sidebar.collapsed .sidebar-item span,
.admin-sidebar.collapsed .sidebar-section-label span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.admin-sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 0;
    margin: 0;
    min-height: unset;
    height: 36px;
    line-height: 1;
}

.admin-sidebar.collapsed .sidebar-item i {
    margin: 0;
    padding: 0;
    display: block;
}

.admin-sidebar.collapsed .sidebar-section-label {
    display: none;
}

.admin-sidebar.collapsed .sidebar-divider {
    display: none;
}

.admin-sidebar.collapsed .sidebar-nav {
    padding: 3rem 0 0.25rem 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 3rem 1rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar-item i {
    flex-shrink: 0;
}

.sidebar-item span {
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #90cdf4;
    border-left-color: #4299e1;
}

.sidebar-item.active {
    background: rgba(66, 153, 225, 0.15);
    color: #90cdf4;
    border-left-color: #4299e1;
}

.sidebar-divider {
    height: 1px;
    background: #4a5568;
    margin: 0.75rem 0;
}

.sidebar-section-label {
    padding: 0.75rem 1rem 0.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-section-label span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity 0.3s ease;
}

/* ==========================================
   MAIN CONTENT AREA
   ========================================== */

.admin-main {
    flex: 1;
    margin-left: 260px;
    margin-top: 64px;
    min-height: calc(100vh - 64px);
    background: #f7fafc;
    transition: margin-left 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    /* Ensure content starts at top */
    display: flex;
    flex-direction: column;
}

.admin-sidebar.collapsed ~ .admin-main {
    margin-left: 70px;
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */

.admin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: #2d3748;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .user-info span {
        display: none;
    }
}

@media (max-width: 640px) {
    .header-content {
        padding: 0 1rem;
    }

    .header-branding {
        margin-left: 0.5rem;
    }

    .header-text {
        display: none;
    }

    .header-right {
        gap: 0.5rem;
    }

    .user-info {
        padding: 0.5rem;
    }

    .user-info span {
        display: none;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .admin-header,
    .admin-sidebar {
        display: none !important;
    }

    .admin-main {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */

/* Animations (slideIn, fadeIn) are defined in admin-unified.css */

/* ==========================================
   UTILITIES
   ========================================== */

.sidebar-hidden {
    display: none;
}

/* Page content styling - no animation here, pages use .fade-in class */

/* Page sections styling */
.page {
    width: 100%;
    margin: 0;
    padding-top: 0 !important;
    /* Force visibility - override any animation issues */
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    /* Ensure pages don't have extra positioning */
    position: static !important;
}

/* Override Tailwind hidden class for pages that should be visible */
.page:not(.hidden) {
    display: block !important;
    flex: 1;
}

/* Ensure hidden pages don't affect layout */
.page.hidden {
    display: none !important;
}

.page .container {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}
