/* ============================================
   Modern Employee Management System Styles
   Mobile-First Responsive Design
   ============================================ */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
}

/* ============================================
   Layout Structure
   ============================================ */

.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Top Header Bar (Minimal)
   ============================================ */

.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

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

.top-header .mobile-menu-toggle,
.top-header .sidebar-expand-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.top-header .mobile-menu-toggle:hover,
.top-header .sidebar-expand-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.top-header .sidebar-expand-toggle {
    display: none; /* Hidden on mobile */
}

@media (min-width: 769px) {
    .top-header .sidebar-expand-toggle {
        display: flex; /* Show on desktop */
    }
    
    .top-header .mobile-menu-toggle {
        display: none; /* Hide mobile menu toggle on desktop */
    }
}

.top-header .company-name {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.top-header .logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.top-header .logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ============================================
   Sidebar Navigation
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    width: 280px;
    height: calc(100vh - 60px);
    background: white;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.sidebar.collapsed {
    width: 70px;
}

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

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* Sidebar toggle button removed - now in header */
.sidebar-toggle {
    display: none;
}

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

.sidebar-menu-item {
    margin-bottom: 0.25rem;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-menu-link:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-menu-link.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu-icon {
    margin-right: 0;
}

.sidebar-menu-text {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-menu-group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-menu-group-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-menu-group-title {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

/* Employee Management submenu */
.sidebar-menu-parent {
    position: relative;
}

.sidebar-menu-toggle {
    cursor: pointer;
}

.sidebar-menu-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.sidebar-menu-parent.expanded .sidebar-menu-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-menu-parent.expanded .sidebar-submenu {
    max-height: 320px;
}

.sidebar-submenu-item {
    margin: 0;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem 0.5rem 3rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-submenu-link:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-submenu-link.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-submenu-icon {
    width: 18px;
    margin-right: 0.75rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.sidebar-submenu-text {
    color: var(--text-primary) !important;
    flex: 1;
    display: inline-block;
}

.sidebar-submenu-link:hover .sidebar-submenu-text {
    color: var(--primary-color) !important;
}

.sidebar-submenu-link.active .sidebar-submenu-text {
    color: var(--primary-color) !important;
}

.sidebar.collapsed .sidebar-submenu {
    display: none;
}

.sidebar.collapsed .sidebar-menu-chevron {
    display: none;
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    margin-left: 280px;
    margin-top: 60px;
    padding: 2rem;
    width: calc(100% - 280px);
    transition: all 0.3s ease;
    min-height: calc(100vh - 60px);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
}

/* ============================================
   Responsive Sidebar
   ============================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* Mobile menu toggle is now in header, no need for fixed positioning */
}

/* ============================================
   Navigation Bar (Legacy - for non-dashboard pages)
   ============================================ */

.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    color: #fff !important;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    transition: transform 0.2s ease;
}

.navbar-brand:hover {
    transform: translateY(-1px);
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    margin: 0 0.25rem;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    transform: translateY(-1px);
}

.navbar-toggler {
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ============================================
   Container & Layout
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 2.5rem 2rem;
    }
}

/* Container within dashboard */
.main-content .container {
    padding: 0;
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.card-header {
    background: linear-gradient(135deg, var(--dark-color) 0%, #334155 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.125rem;
    border-bottom: none;
}

.card-body {
    padding: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
        overflow-x: auto;
    }
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
    color: white;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: #2563eb;
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

@media (max-width: 768px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
}

/* ============================================
   Tables
   ============================================ */

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: -1.5rem;
    padding: 1.5rem;
}

@media (max-width: 768px) {
    .table-responsive {
        margin: -1rem;
        padding: 1rem;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    background: white;
}

@media (max-width: 768px) {
    .table {
        min-width: 600px;
    }
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--light-color);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 768px) {
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .table th {
        font-size: 0.6875rem;
    }
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: white;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .form-control,
    .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border-color: var(--info-color);
    color: #1e40af;
}

/* ============================================
   Stats Grid (Dashboard)
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

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

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

@media (max-width: 640px) {
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.75rem;
    }
}

/* ============================================
   Action Buttons
   ============================================ */

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #475569;
}

/* ============================================
   Search Form
   ============================================ */

.search-form {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-form .form-control {
    flex: 1;
    min-width: 200px;
}

.search-form .btn {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .search-form {
        flex-direction: column;
    }
    
    .search-form .form-control,
    .search-form .btn {
        width: 100%;
    }
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.empty-state .btn {
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .empty-state {
        padding: 2rem 1rem;
    }
}

/* ============================================
   Typography
   ============================================ */

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

.text-muted {
    color: var(--text-secondary);
}

/* ============================================
   Utility Classes
   ============================================ */

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

@media (max-width: 768px) {
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start !important;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .navbar,
    .btn,
    .action-buttons {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
