/* ============================================
   EMPLOYEE MASTER SYSTEM - COMPLETE RESPONSIVE CSS
   Mobile First Design | Works on all devices
   ============================================ */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --secondary: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --dark: #1F2937;
    --light: #F3F4F6;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 16px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Section */
.header {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.add-btn {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Alert Messages */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    animation: slideDown 0.4s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--secondary);
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid var(--info);
}

/* Filter Bar */
.filter-bar {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.filter-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
    font-size: 0.875rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--white);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-group button {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
}

.filter-group button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.reset-btn {
    background: #6B7280 !important;
}

.reset-btn:hover {
    background: #4B5563 !important;
}

/* Stats Cards */
.stats {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: var(--shadow-md);
}

.stat-item {
    text-align: center;
    flex: 1;
    min-width: 100px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #6B7280;
    margin-top: 5px;
}

/* Table Container - Mobile Responsive */
.table-container {
    background: var(--white);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Responsive Table */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 12px;
    font-weight: 600;
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:hover {
    background: var(--light);
    transition: 0.2s;
}

/* Employee Photo */
.employee-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.no-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #9CA3AF;
    border: 2px solid var(--border);
}

/* Status Badges */
.status-badge {
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.status-active {
    background: #D1FAE5;
    color: #065F46;
}

.status-resigned {
    background: #FEF3C7;
    color: #92400E;
}

.status-terminated {
    background: #FEE2E2;
    color: #991B1B;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    cursor: pointer;
}

.btn-view {
    background: var(--info);
    color: white;
}

.btn-view:hover {
    background: #2563EB;
    transform: translateY(-1px);
}

.btn-edit {
    background: var(--warning);
    color: white;
}

.btn-edit:hover {
    background: #D97706;
    transform: translateY(-1px);
}

.btn-delete {
    background: var(--danger);
    color: white;
}

.btn-delete:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

/* Form Styles (for create.php & edit.php) */
.form-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.form-title {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary);
    color: var(--dark);
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 25px;
    background: #FAFAFA;
}

legend {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    margin-left: 10px;
}

.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

.form-group label {
    width: 200px;
    font-weight: 600;
    color: var(--dark);
    padding-top: 10px;
}

.form-group input,
.form-group select,
.form-group textarea {
    flex: 1;
    min-width: 250px;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.current-doc {
    width: 100%;
    margin-left: 210px;
    font-size: 12px;
    color: #6B7280;
    padding: 5px 0;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-submit {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    color: white;
    padding: 12px 30px;
    font-size: 16px;
}

.btn-cancel {
    background: #6B7280;
    color: white;
    padding: 12px 30px;
}

/* View Page Styles */
.view-container {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.view-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.view-photo {
    margin-bottom: 20px;
}

.view-photo img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: var(--shadow-lg);
    object-fit: cover;
}

.view-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.view-section h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.info-item {
    background: var(--light);
    padding: 12px 15px;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
}

.info-label {
    font-weight: 600;
    color: #6B7280;
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
}

.info-value {
    color: var(--dark);
    font-size: 14px;
    word-break: break-word;
}

/* Pagination */
.pagination {
    margin-top: 20px;
    text-align: center;
    padding: 15px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-title {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 10px;
}

.empty-text {
    color: #6B7280;
    margin-bottom: 20px;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet Devices (768px and below) */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .stats {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    /* Make table horizontally scrollable on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 650px;
    }
    
    th, td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .btn {
        justify-content: center;
        width: 100%;
    }
    
    /* Form responsive */
    .form-group {
        flex-direction: column;
    }
    
    .form-group label {
        width: 100%;
        padding-top: 0;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        min-width: auto;
    }
    
    .current-doc {
        margin-left: 0;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Devices (480px and below) */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .add-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .alert {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    .employee-photo,
    .no-photo {
        width: 40px;
        height: 40px;
    }
    
    .status-badge {
        padding: 3px 8px;
        font-size: 10px;
    }
    
    .btn {
        padding: 5px 8px;
        font-size: 10px;
    }
    
    .view-header {
        padding: 20px;
    }
    
    .view-photo img {
        width: 80px;
        height: 80px;
    }
    
    .view-section h2 {
        font-size: 16px;
    }
    
    .info-item {
        padding: 10px;
    }
    
    fieldset {
        padding: 15px;
    }
    
    legend {
        font-size: 12px;
        padding: 5px 12px;
    }
}

/* Landscape Mode Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .stats {
        flex-direction: row;
    }
}

/* Large Desktop Screens (1200px and above) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .add-btn,
    .filter-bar,
    .action-buttons,
    .btn,
    .header a {
        display: none;
    }
    
    .container {
        max-width: 100%;
    }
    
    table {
        border: 1px solid #ddd;
    }
    
    th {
        background: #f0f0f0;
        color: black;
    }
}

/* Loading Animation */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.loading {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-size: 1000px 100%;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}