/* Master Page Styles */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.master-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(9px);
    border-bottom: 0.9px solid rgba(255, 255, 255, 0.2);
    padding: 0.9rem 1.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1.8px 18px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left .app-title {
    font-size: 1.62rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.9rem 1.35rem;
    border-radius: 10.8px;
    border: 0.9px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 3.6px 18px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(9px);
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.user-name {
    font-weight: 700;
    color: #2d3748;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-id {
    font-size: 0.75rem;
    color: #4a5568;
    font-weight: 500;
}

.company-id {
    font-size: 0.75rem;
    color: #4a5568;
    font-weight: 500;
}

.btn-logout {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
}

/* Sidebar Styles */
.sidebar {
    min-width: 250px;
    max-width: 250px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    padding: 4rem 0 2rem 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sidebar.collapsed {
    min-width: 0;
    max-width: 0;
    padding: 0;
    overflow: visible;
    border-right: none;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02), rgba(118, 75, 162, 0.02));
    pointer-events: none;
}

.sidebar-toggle {
    position: fixed;
    left: 220px;
    top: 15px;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.sidebar.collapsed .sidebar-toggle {
    left: 15px;
    background: linear-gradient(135deg, #4c51bf, #553c9a);
    transform: translateX(0);
}

.sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.hamburger-icon {
    width: 16px;
    height: 12px;
    position: relative;
    display: block;
    transition: all 0.3s ease;
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
    width: 16px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.hamburger-icon::before {
    top: -5px;
}

.hamburger-icon::after {
    top: 5px;
}

.sidebar.collapsed .hamburger-icon {
    background: transparent;
}

.sidebar.collapsed .hamburger-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.sidebar.collapsed .hamburger-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

.nav-menu {
    padding: 0 1rem;
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    margin-bottom: 0.5rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #4a5568;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
}

.menu-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: translateX(5px);
    border-color: rgba(102, 126, 234, 0.2);
}

.menu-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.menu-item.active .menu-link {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border-color: transparent;
}

.menu-item.active .menu-link:hover {
    transform: translateX(3px) translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.menu-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    width: 24px;
    text-align: center;
}

.menu-text {
    font-size: 0.95rem;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 1.8rem;
    overflow-y: auto;
    min-width: 0;
    transition: all 0.3s ease;
}

.content-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 0.9rem 0;
    padding-bottom: 0.675rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
}

.content-body {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow-y: auto;
    padding: 1rem;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
}

.card-body {
    padding: 2rem;
}

.dashboard-cards {
    padding: 2rem;
}

/* Mobile-first sidebar behavior */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
        min-width: 280px;
        max-width: 280px;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar.collapsed {
        left: -100%;
        min-width: 280px;
        max-width: 280px;
        padding: 4rem 0 2rem 0;
    }
    
    .sidebar-toggle {
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1002;
        width: 44px;
        height: 44px;
    }
    
    .hamburger-icon {
        width: 22px;
        height: 18px;
    }
    
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-left .app-title {
        font-size: 1.5rem;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
    }
    
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 1rem 0;
    }
    
    .nav-menu {
        padding: 0 0.5rem;
    }
    
    .menu-list {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .menu-item {
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .menu-link {
        white-space: nowrap;
        padding: 0.75rem 1rem;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .dashboard-cards {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .header-left .app-title {
        font-size: 1.25rem;
    }
    
    .user-details {
        align-items: center;
    }
    
    .user-name, .user-id {
        font-size: 0.8rem;
    }
    
    .btn-logout {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .content-area {
        padding: 0.5rem;
    }
    
    .dashboard-cards {
        padding: 0.5rem;
    }
    
    .card-header, .card-body {
        padding: 1rem;
    }
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #667eea;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 350px;
}

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

.notification-success {
    border-left-color: #48bb78;
}

.notification-error {
    border-left-color: #f56565;
}

.notification-warning {
    border-left-color: #ed8936;
}

.notification-message {
    flex: 1;
    font-size: 0.9rem;
    color: #2d3748;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #2d3748;
}

/* Tooltip Styles */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10001;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.5s ease-out;
}

.menu-item {
    animation: fadeInUp 0.3s ease-out;
}

.menu-item:nth-child(2) {
    animation-delay: 0.1s;
}

.menu-item:nth-child(3) {
    animation-delay: 0.2s;
}