* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Styles */
.header {
    background: white;
    padding: 30px;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.header h1 {
    color: #333;
    font-size: 32px;
    font-weight: 600;
}

.header .date {
    font-size: 18px;
    color: #666;
    font-weight: 500;
}

/* Dashboard Styles */
.dashboard {
    background: white;
    border-radius: 0 0 10px 10px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-box,
.filter-select,
.filter-month {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-box:focus,
.filter-select:focus,
.filter-month:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.filter-select,
.filter-month {
    min-width: 200px;
    cursor: pointer;
    background: white;
}

/* Button Styles */
.btn-export,
.btn-print,
.btn-add-employee {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-export {
    background: #667eea;
    color: white;
}

.btn-export:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-print {
    background: #48bb78;
    color: white;
}

.btn-print:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-add-employee {
    background: #ed8936;
    color: white;
}

.btn-add-employee:hover {
    background: #dd6b20;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.4);
}

.btn-add-employee span {
    font-size: 18px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    color: #333;
    font-size: 24px;
    margin: 0;
}

.close-btn {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

/* Employee Form Styles */
.employee-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group select {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background-color: white;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #999;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.btn-submit,
.btn-cancel {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-submit {
    background: #667eea;
    color: white;
}

.btn-submit:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-cancel {
    background: #e2e8f0;
    color: #333;
}

.btn-cancel:hover {
    background: #cbd5e0;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Table Wrapper */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 40px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.salary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.salary-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.salary-table th {
    padding: 1px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid #5a67d8;
}

/* Sticky Name and # columns */
.salary-table th:nth-child(1),
.salary-table th:nth-child(2),
.salary-table td:nth-child(1),
.salary-table td:nth-child(2) {
    position: sticky;
    z-index: 5;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.salary-table th:nth-child(1),
.salary-table th:nth-child(2) {
    z-index: 15;
}

.salary-table tbody tr td:nth-child(1),
.salary-table tbody tr td:nth-child(2) {
    background: white;
    position: sticky;
    padding: 1px;
}

.salary-table tbody tr td {
    padding: 1px;
    border: 1px solid #e0e0e0;
}

.salary-table tbody tr:nth-child(even) td:nth-child(1),
.salary-table tbody tr:nth-child(even) td:nth-child(2) {
    background: #f8f9fa;
}

.salary-table tbody tr:hover td:nth-child(1),
.salary-table tbody tr:hover td:nth-child(2) {
    background: #f0f1ff;
}

.salary-table tbody tr:last-child td:nth-child(1),
.salary-table tbody tr:last-child td:nth-child(2) {
    background: #f0f1ff;
}

/* Totals Row Styling */
.salary-table tbody tr.totals-row {
    font-weight: 700;
    background: #2d3748;
    color: white;
    border-top: 3px solid #667eea;
}

.salary-table tbody tr.totals-row td {
    padding: 1px;
    border: 1px solid #1a202c;
    color: white;
    font-size: 13px;
}

/* Editable Input Box Styling */
.salary-table td input.table-input {
    width: 100%;
    padding: 1px;
    border: 2px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background-color: rgba(102, 126, 234, 0.05);
    transition: all 0.3s ease;
    text-align: right;
    cursor: pointer;
}

.salary-table td input.table-input:hover {
    background-color: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.salary-table td input.table-input:focus {
    outline: none;
    background-color: #ffffff;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
    transform: scale(1.02);
    font-weight: 600;
    color: #1a202c;
}

.salary-table td input.table-input:active {
    background-color: #ffffff;
    border-color: #5568d3;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.3);
}

.salary-table tbody tr.totals-row td.totals-cell {
    background: #2d3748;
    color: #48bb78;
    font-weight: 700;
}

/* Left position for sticky columns */
.salary-table th:nth-child(1),
.salary-table td:nth-child(1) {
    left: 0;
    min-width: 50px;
}

.salary-table th:nth-child(2),
.salary-table td:nth-child(2) {
    left: 50px;
    min-width: 120px;
}

/* Past Tense Bal Column - Light Color */
.salary-table td:nth-child(10) {
    background-color: #fff3cd;
}

.salary-table tbody tr:nth-child(even) td:nth-child(10) {
    background-color: #ffe8a1;
}

.salary-table tbody tr:hover td:nth-child(10) {
    background-color: #ffeeba;
}

.salary-table tbody tr:last-child td:nth-child(10) {
    background-color: #ffdd57;
}

.salary-table td {
    padding: 12px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.salary-table tbody tr {
    transition: background-color 0.2s ease;
    background: white;
}

.salary-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.salary-table tbody tr:hover {
    background: #f0f1ff;
}

/* Highlighted cells for totals */
.salary-table tbody tr:last-child {
    font-weight: 600;
    background: #f0f1ff;
    border-top: 2px solid #667eea;
}

.salary-table tbody tr:last-child td {
    border-color: #667eea;
    padding: 14px 12px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    white-space: nowrap;
    padding: 8px !important;
}

.btn-edit,
.btn-delete {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
}

.btn-edit {
    background: #4299e1;
    color: white;
}

.btn-edit:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.4);
}

.btn-delete {
    background: #f56565;
    color: white;
}

.btn-delete:hover {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(245, 101, 101, 0.4);
}

/* Summary Section */
.summary-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.summary-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.summary-card .label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-card .value {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header h1 {
        font-size: 24px;
    }

    .filters {
        flex-direction: column;
    }

    .search-box,
    .filter-select,
    .btn-add-employee {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        padding: 25px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .salary-table {
        font-size: 12px;
    }

    .salary-table th,
    .salary-table td {
        padding: 8px 6px;
    }

    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .summary-card .value {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 20px;
    }

    .dashboard {
        padding: 15px;
    }

    .salary-table {
        font-size: 11px;
    }

    .salary-table th,
    .salary-table td {
        padding: 6px 4px;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header,
.dashboard {
    animation: fadeIn 0.5s ease-out;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .filters {
        display: none;
    }

    .salary-table {
        border: 1px solid #000;
    }

    .salary-table th,
    .salary-table td {
        border: 1px solid #000;
    }

    .summary-section {
        page-break-before: avoid;
    }
}

/* Scrollbar Styling */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
