/* ===================================================
   EMPLOYEE CARDS - RESPONSIVE LAYOUT
   Landscape for Desktop, Portrait for Mobile
   =================================================== */

/* Container for employee cards */
.employee-cards-container {
    display: grid;
    grid-template-columns: 1fr; /* Single column - one tile per row */
    gap: 1.25rem;
    margin-top: 1.5rem;
    max-width: none;
    padding: 0 1rem; /* Consistent horizontal padding */
}

/* Responsive container adjustments */
@media (max-width: 767px) {
    .employee-cards-container {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 1rem;
        padding: 0; /* Remove padding on mobile */
    }
}

/* Base employee card styling */
.employee-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: visible; /* Allow dropdown to show outside card */
    z-index: 1; /* Base z-index for cards */
}

.employee-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.employee-card.selected {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.25);
}

/* Checkbox positioning */
.card-checkbox {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    padding: 2px;
}

/* ===================================================
   DESKTOP LANDSCAPE LAYOUT (768px and up)
   =================================================== */

@media (min-width: 768px) {
    /* Allow card to use full available width */
    .employee-card {
        width: 100%; /* Use full container width */
    }

    .employee-card-desktop {
        display: flex;
        align-items: center;
        padding: 1rem 1.25rem 1rem 3rem; /* Extra left padding for checkbox */
        min-height: 80px;
    }

    .employee-card-mobile {
        display: none;
    }

    /* Left section - Employee Info */
    .employee-info-section {
        flex: 2;
        min-width: 0; /* Allow text truncation */
        margin-right: 1.5rem;
    }

    .employee-header {
        margin-bottom: 0.5rem;
    }

    .employee-name {
        font-size: 1.1rem;
        font-weight: 600;
        color: #2c3e50;
        margin: 0 0 0.25rem 0;
        line-height: 1.3;
    }

    .employee-position {
        font-size: 0.875rem;
        color: #6c757d;
        font-weight: 400;
    }

    .employee-contact {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .contact-item {
        font-size: 0.8125rem;
        color: #495057;
        display: flex;
        align-items: center;
    }

    .contact-item i {
        width: 16px;
        flex-shrink: 0;
    }

    /* Center section - Status & Stats */
    .employee-status-section {
        flex: 1.5;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        margin-right: 1.5rem;
        min-width: 0;
    }

    .status-badge-container {
        text-align: center;
    }

    .employee-status-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 20px;
        border: 1px solid transparent;
    }

    .employee-stats {
        display: flex;
        gap: 0.5rem; /* Smaller gap for 4 items */
        text-align: center;
        flex-wrap: nowrap; /* Prevent wrapping */
        justify-content: center;
        align-items: center;
        min-width: 200px; /* Ensure enough space for 4 items */
    }

    .stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-width: 40px; /* Smaller for 4 items */
        flex: 0 0 auto;
    }

    .stat-value {
        font-size: 1rem;
        font-weight: 700;
        color: #2c3e50;
        line-height: 1.2;
    }

    .stat-label {
        font-size: 0.7rem;
        color: #6c757d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-top: 0.125rem;
    }

    /* Right section - Actions */
    .employee-actions-section {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
        min-width: 0;
    }

    .primary-actions {
        display: flex;
        gap: 0.5rem;
    }

    .dropdown-actions {
        display: flex;
    }
}

/* ===================================================
   MOBILE PORTRAIT LAYOUT (767px and below)
   =================================================== */

@media (max-width: 767px) {
    .employee-card-desktop {
        display: none;
    }

    .employee-card-mobile {
        display: block;
        padding: 1rem 1rem 1rem 3rem; /* Extra left padding for checkbox */
    }

    /* Mobile header */
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #e9ecef;
    }

    .mobile-header .employee-header {
        flex: 1;
        margin-right: 1rem;
        min-width: 0;
    }

    .mobile-header .employee-name {
        font-size: 1rem;
        font-weight: 600;
        color: #2c3e50;
        margin: 0 0 0.25rem 0;
        line-height: 1.3;
    }

    .mobile-header .employee-position {
        font-size: 0.8125rem;
        color: #6c757d;
    }

    /* Mobile body */
    .mobile-body {
        margin-bottom: 0.75rem;
    }

    .contact-info {
        margin-bottom: 0.75rem;
    }

    .contact-info .contact-item {
        font-size: 0.8125rem;
        color: #495057;
        margin-bottom: 0.375rem;
        display: flex;
        align-items: center;
    }

    .contact-info .contact-item i {
        width: 16px;
        flex-shrink: 0;
    }

    .contact-info .text-truncate {
        max-width: 200px;
    }

    .status-container {
        text-align: center;
        margin-bottom: 0.75rem;
    }

    .status-container .employee-status-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-radius: 20px;
        border: 1px solid transparent;
    }

    .mobile-stats {
        display: flex;
        justify-content: space-around;
        text-align: center;
        padding: 0.5rem 0;
        background: rgba(248, 249, 250, 0.5);
        border-radius: 6px;
    }

    .mobile-stats .stat-item {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .mobile-stats .stat-value {
        font-size: 1rem;
        font-weight: 700;
        color: #2c3e50;
        line-height: 1.2;
    }

    .mobile-stats .stat-label {
        font-size: 0.7rem;
        color: #6c757d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-top: 0.125rem;
    }

    /* Mobile footer */
    .mobile-footer {
        padding-top: 0.75rem;
        border-top: 1px solid #e9ecef;
    }

    .mobile-actions {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
    }
}

/* ===================================================
   STATUS BADGE COLORS
   =================================================== */

.employee-status-badge.status-primary {
    background: linear-gradient(135deg, #cce5ff 0%, #b3d7ff 100%);
    color: #004085;
    border-color: #b3d7ff;
}

.employee-status-badge.status-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-color: #bee5eb;
}

.employee-status-badge.status-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-color: #ffeaa7;
}

.employee-status-badge.status-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-color: #c3e6cb;
}

.employee-status-badge.status-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-color: #f5c6cb;
}

.employee-status-badge.status-secondary {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    color: #383d41;
    border-color: #d6d8db;
}

/* ===================================================
   RESPONSIVE ADJUSTMENTS
   =================================================== */

/* Tablet landscape adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    .employee-info-section {
        flex: 1.8;
        margin-right: 1rem;
    }

    .employee-status-section {
        flex: 1.2;
        margin-right: 1rem;
    }

    .employee-actions-section {
        flex: 0.8;
    }

    .employee-stats {
        gap: 0.75rem;
    }

    .stat-item {
        min-width: 45px;
    }
}

/* Large desktop adjustments */
@media (min-width: 1200px) {
    .employee-card-desktop {
        min-height: 90px;
        padding: 1.25rem 1.5rem 1.25rem 3.5rem;
    }

    .employee-name {
        font-size: 1.125rem;
    }

    .employee-stats {
        gap: 1.25rem;
    }

    .stat-item {
        min-width: 55px;
    }
}

/* ===================================================
   HOVER EFFECTS AND INTERACTIONS
   =================================================== */

.employee-card:hover .employee-name {
    color: #007bff;
    transition: color 0.2s ease;
}

.employee-card:hover .stat-value {
    color: #007bff;
    transition: color 0.2s ease;
}

/* Button styling for actions */
.primary-actions .btn,
.mobile-actions .btn {
    min-width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-actions .btn {
    min-width: 32px;
    height: 32px;
}

/* ===================================================
   ACCESSIBILITY IMPROVEMENTS
   =================================================== */

.employee-card:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.card-checkbox input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .employee-card {
        border-width: 2px;
    }
    
    .employee-status-badge {
        border-width: 2px;
        font-weight: 700;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .employee-card,
    .employee-card:hover,
    .employee-name,
    .stat-value {
        transition: none;
    }
    
    .employee-card:hover {
        transform: none;
    }
}

/* ===================================================
   DROPDOWN FIXES
   =================================================== */

/* Boost z-index for card with open dropdown */
.employee-card:has(.dropdown-menu.show),
.employee-card .dropdown.show {
    z-index: 1000;
}

/* Alternative for browsers that don't support :has() */
.employee-card.dropdown-open {
    z-index: 1000;
}

/* Ensure dropdown menus appear above other elements */
.employee-card .dropdown-menu {
    z-index: 1050;
    position: absolute;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    min-width: 220px;
}

/* Ensure dropdown positioning works correctly */
.employee-card .dropdown {
    position: relative;
    z-index: 1051; /* Higher than dropdown menu to ensure proper stacking */
}

/* Additional fix: ensure dropdown button triggers stay on top */
.employee-card .dropdown-toggle {
    position: relative;
    z-index: 1052;
}

/* Mobile dropdown adjustments */
@media (max-width: 767px) {
    .employee-card .dropdown-menu {
        min-width: 200px;
        font-size: 0.875rem;
    }
}

/* Ensure proper container spacing for dropdown visibility */
.employee-cards-container {
    padding-bottom: 2rem; /* Extra space for last card dropdowns */
}
