/* admin/style.css - Fixed and improved styles */

/* --- Variables --- */
:root{
  --primary:#007bff;
  --primary-dark:#0056b3;
  --bg:#f8f9fa; /* Lighter background */
  --card:#fff;
  --radius:8px;
  --shadow:0 4px 12px rgba(0,0,0,0.08);
  --header-bg: linear-gradient(90deg, #1c3664, #3a5c96); /* Deep Blue Gradient for Banner */
  --text-color: #333;
  --border-color: #e9ecef;
}

*{box-sizing:border-box;margin:0;padding:0;font-family: Arial, sans-serif;}
body{background:var(--bg);color:var(--text-color);line-height:1.5}

/* --- Login Page Styles --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--header-bg); /* Use banner gradient for login background */
}

.center-login-container {
    padding-top: 0;
    min-height: auto;
}

.login-card {
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    color: #1c3664;
    margin-bottom: 20px;
}

/* --- Dashboard Header (Banner) Styles --- */
.main-header {
    background: var(--header-bg);
    color: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.company-title {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-right: 20px;
}

.contact-info {
    font-size: 0.9rem;
    line-height: 1.2;
}
.contact-info p {
    margin: 0;
}
.contact-info strong {
    font-weight: bold;
}

#logoutButton {
    background-color: var(--primary-dark);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
#logoutButton:hover {
    background-color: #c82333;
}

/* --- Dashboard Layout (Cards) Styles --- */
.container {
    display: flex;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    flex-direction: row; /* Enforce desktop layout */
    align-items: flex-start;
}

.card {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 0; /* Remove margin-auto from previous card style */
}

.search-card {
    flex: 0 0 300px; /* Fixed width for search column */
}

.result-card {
    flex-grow: 1; /* Takes up most of the space */
    min-width: 400px;
}

.help-card {
    flex: 0 0 300px; /* Fixed width for help column */
}

.card h3, .card h4 {
    color: #1c3664;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
}

/* inputs */
.input-group{margin-bottom:15px}
.input-group label{display:block;margin-bottom:5px;font-weight:600;font-size:0.95rem}
.input-group input{width:100%;padding:10px;border:1px solid var(--border-color);border-radius:4px;font-size:1rem}

/* buttons */
.primary-button{width:100%;padding:10px;margin-top:5px;background:var(--primary);color:#fff;border:none;border-radius:4px;font-size:1rem;cursor:pointer;font-weight:700;transition:background-color 0.2s}
.primary-button:disabled {
    background-color: #6c757d;
    opacity: 0.6;
    cursor: not-allowed;
}
.primary-button:not(:disabled):hover{background:var(--primary-dark)}
.secondary-button{background:#6c757d;color:#fff;padding:10px 14px;border:none;border-radius:4px;cursor:pointer;font-weight:700;transition:background-color 0.2s}
.secondary-button:hover{background:#5a6268}

.error-message {
    color: #dc3545;
    font-weight: bold;
    margin: 10px 0;
}

/* results area (table for readable labels) */
#salaryDetails table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.95rem;
}
#salaryDetails td {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
    text-align: left;
}
#salaryDetails td:first-child {
    font-weight: 600;
}
#salaryDetails td:last-child {
    text-align: right;
    font-weight: bold;
}
#salaryDetails .highlight-row {
    background: #e0f7fa;
}


/* --- Hidden Salary Slip Template Styles (for PDF/Print) --- */
.salary-slip-template {
    width: 210mm; /* A4 width */
    min-height: 297mm; /* A4 height */
    margin: 20px auto;
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 15mm;
    display: none; /* Hide template in screen view */
}

.slip-content {
    border: 1px solid #333; /* Outer border for a clean look */
    padding: 15px;
}

.slip-header {
    border-bottom: 2px solid #000;
    margin-bottom: 15px;
    padding-bottom: 10px;
    text-align: center;
}

.slip-company-title {
    font-size: 2.2rem;
    color: #1c3664;
    font-weight: 900;
    margin-bottom: 5px;
}

.slip-address {
    font-size: 0.8rem;
    line-height: 1.3;
    color: #555;
    margin-top: 5px;
}

.slip-title-bar h3 {
    background-color: #f0f0f0;
    padding: 8px;
    margin-top: 10px;
    font-size: 1.1rem;
    text-align: center;
    border: 1px solid #ccc;
}

.slip-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.slip-details-table td {
    border: 1px solid #ccc;
    padding: 6px 10px;
}

.slip-details-table .label {
    font-weight: bold;
    width: 30%;
    background-color: #f9f9f9;
}

.slip-details-table .deduction-label {
    background-color: #ffe0e0;
}
.slip-details-table .deduction-value {
    background-color: #fff0f0;
}

.slip-details-table .net-pay-row .label,
.slip-details-table .net-pay-row td {
    font-size: 1.1rem;
    font-weight: bold;
    background-color: #e9f5ff; 
    color: #000;
}

.slip-details-table .net-pay-row td:last-child {
    text-align: center;
    background-color: #cce0ff;
}

.slip-footer-section {
    display: flex;
    justify-content: space-around;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px dashed #ccc;
}

.signature-area {
    text-align: center;
    font-size: 0.9rem;
}

.signature-area p:first-child {
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.slip-footer-text {
    text-align: center;
    font-size: 0.75rem;
    color: #777;
    margin-top: 20px;
}

/* --- Responsive & Print Media Queries --- */

/* Mobile Layout */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
        padding: 10px;
    }
    .search-card, .result-card, .help-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
    }
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 10px;
    }
    .company-title {
        font-size: 1.5rem;
        margin-right: 0;
    }
    .contact-info {
        font-size: 0.8rem;
    }
}

/* Print Media Query: SHOW ONLY SLIP, HIDE EVERYTHING ELSE */
@media print {
    body > *:not(.salary-slip-template) {
        display: none !important; 
    }

    .salary-slip-template {
        display: block !important; 
        width: 100%; 
        min-height: auto;
        padding: 10mm; 
        box-shadow: none;
    }
    
    .slip-content {
        border: 2px solid #000; 
    }
    
    /* Ensure colors print for key elements */
    .slip-details-table .label,
    .slip-details-table .net-pay-row .label,
    .slip-details-table .net-pay-row td,
    .slip-header .slip-company-title {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
