/*
 Theme Name:   Astra Child
 Template:     astra
 Version:      1.0.2
*/

/* Override Astra's flex layout for all form pages */
body.page-template-page-departments-form .ast-container,
body.page-template-page-employees-form .ast-container,
body.page-template-page-salary-form .ast-container,
body.page-template-page-designations-form .ast-container,
body.page-template-page-mode-of-payment-form .ast-container,
body.page-template-page-company-form .ast-container {
    display: block;
}

/* Style the title on all form pages */
body.page-template-page-departments-form h2,
body.page-template-page-employees-form h2,
body.page-template-page-salary-form h2,
body.page-template-page-designations-form h2,
body.page-template-page-mode-of-payment-form h2,
body.page-template-page-company-form h2 {
    display: block;
    margin: 20px 0 20px 20px;
    width: 100%;
    font-size: 1.8em;
    color: #333;
}

/* Standard form styling */
body.page-template-page-departments-form .hrms-form,
body.page-template-page-designations-form .hrms-form,
body.page-template-page-mode-of-payment-form .hrms-form,
body.page-template-page-company-form .hrms-form {
    margin: 20px 0 20px 20px;
    display: block;
    clear: both;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Style Employees form as profile */
body.page-template-page-employees-form .hrms-form.employee-profile {
    margin: 20px 0 20px 20px;
    display: block;
    clear: both;
    padding: 20px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
}

/* Photo section */
.employee-profile .photo-section {
    margin-bottom: 30px;
    text-align: center;
}

.employee-profile .photo-section label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.employee-profile .photo-preview {
    display: inline-block;
}

.employee-profile #photo-placeholder {
    width: 120px;
    height: 160px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
}

.employee-profile .photo-actions {
    margin-top: 10px;
}

.employee-profile .select-photo,
.employee-profile .remove-photo {
    padding: 8px 16px;
    margin: 0 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.employee-profile .select-photo {
    background: #0073aa;
    color: #fff;
}

.employee-profile .select-photo:hover {
    background: #005d82;
}

.employee-profile .remove-photo {
    background: #d63638;
    color: #fff;
}

.employee-profile .remove-photo:hover {
    background: #c82333;
}

/* Profile grid for three columns */
.employee-profile .profile-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.employee-profile .profile-column {
    flex: 1;
    min-width: 320px;
}

/* Profile sections */
.employee-profile .profile-section {
    margin-bottom: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

.employee-profile .profile-section h3 {
    margin: 0 0 15px;
    font-size: 1.2em;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

/* Form rows */
.employee-profile .form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.employee-profile .form-row label {
    width: 300px;
    max-width: 100%;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.employee-profile .form-row input,
.employee-profile .form-row select {
    width: 300px;
    max-width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    height: 40px;
    font-size: 0.9em;
}

.employee-profile .form-row input[type="file"] {
    width: auto;
    padding: 5px;
}

/* Bank fields */
.employee-profile .bank-field {
    display: none;
}

.employee-profile .bank-field.active {
    display: flex;
}

/* Salary History button row */
.employee-profile .salary-history-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.employee-profile .salary-history-row label {
    width: 300px;
    max-width: 100%;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.employee-profile .salary-history-btn {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 300px;
    max-width: 100%;
    font-size: 0.9em;
}

.employee-profile .salary-history-btn:hover {
    background: #005d82;
}

/* Form actions */
.employee-profile .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.employee-profile .form-actions input[type="submit"],
.employee-profile .form-actions .cancel-button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
}

.employee-profile .form-actions input[type="submit"] {
    background: #0073aa;
    color: #fff;
}

.employee-profile .form-actions input[type="submit"]:hover {
    background: #005d82;
}

.employee-profile .form-actions .cancel-button {
    background: #6c757d;
    color: #fff;
}

.employee-profile .form-actions .cancel-button:hover {
    background: #5a6268;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: auto;
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5em;
    cursor: pointer;
    color: #333;
}

.modal-content h3 {
    margin: 0 0 20px;
    font-size: 1.3em;
}

.salary-history-table {
    width: 100%;
    border-collapse: collapse;
}

.salary-history-table th,
.salary-history-table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.salary-history-table th:nth-child(1),
.salary-history-table td:nth-child(1) {
    width: 20%;
}

.salary-history-table th:nth-child(2),
.salary-history-table td:nth-child(2) {
    width: 20%;
}

.salary-history-table th:nth-child(3),
.salary-history-table td:nth-child(3) {
    width: 20%;
}

.salary-history-table th:nth-child(4),
.salary-history-table td:nth-child(4) {
    width: 15%;
}

.salary-history-table th:nth-child(5),
.salary-history-table td:nth-child(5) {
    width: 15%;
}

.salary-history-table th:nth-child(6),
.salary-history-table td:nth-child(6) {
    width: 10%;
}

.salary-history-table input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.add-salary-history {
    margin-top: 10px;
    padding: 10px 20px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.add-salary-history:hover {
    background: #218838;
}

.edit-record,
.delete-record {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.edit-record {
    background: #0073aa;
    color: #fff;
}

.edit-record:hover {
    background: #005d82;
}

.delete-record {
    background: #dc3545;
    color: #fff;
}

.delete-record:hover {
    background: #c82333;
}

/* Style table for tabular forms */
body.page-template-page-departments-form .hrms-table,
body.page-template-page-designations-form .hrms-table,
body.page-template-page-mode-of-payment-form .hrms-table,
body.page-template-page-company-form .hrms-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    display: block;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.hrms-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #e9ecef;
}

.hrms-table th,
.hrms-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

/* Column widths for Company Form */
body.page-template-page-company-form .hrms-table th:nth-child(1),
body.page-template-page-company-form .hrms-table td:nth-child(1) {
    width: 20%;
}

body.page-template-page-company-form .hrms-table th:nth-child(2),
body.page-template-page-company-form .hrms-table td:nth-child(2) {
    width: 15%;
}

body.page-template-page-company-form .hrms-table th:nth-child(3),
body.page-template-page-company-form .hrms-table td:nth-child(3) {
    width: 65%;
}

/* Column widths for Departments Form */
body.page-template-page-departments-form .hrms-table th:nth-child(1),
body.page-template-page-departments-form .hrms-table td:nth-child(1) {
    width: 30%;
}

body.page-template-page-departments-form .hrms-table th:nth-child(2),
body.page-template-page-departments-form .hrms-table td:nth-child(2) {
    width: 70%;
}

/* Column widths for Designations Form */
body.page-template-page-designations-form .hrms-table th:nth-child(1),
body.page-template-page-designations-form .hrms-table td:nth-child(1) {
    width: 25%;
}

body.page-template-page-designations-form .hrms-table th:nth-child(2),
body.page-template-page-designations-form .hrms-table td:nth-child(2) {
    width: 25%;
}

body.page-template-page-designations-form .hrms-table th:nth-child(3),
body.page-template-page-designations-form .hrms-table td:nth-child(3) {
    width: 50%;
}

/* Column widths for Mode of Payment Form */
body.page-template-page-mode-of-payment-form .hrms-table th:nth-child(1),
body.page-template-page-mode-of-payment-form .hrms-table td:nth-child(1) {
    width: 30%;
}

body.page-template-page-mode-of-payment-form .hrms-table th:nth-child(2),
body.page-template-page-mode-of-payment-form .hrms-table td:nth-child(2) {
    width: 70%;
}

.hrms-table th {
    font-weight: 600;
}

.hrms-table input[type="text"],
.hrms-table input[type="number"],
.hrms-table select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    height: 38px;
}

.hrms-table textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    height: 38px;
    resize: vertical;
}

/* Style new record row */
.hrms-table .new-record td {
    background-color: #f0fff0;
    border: 2px solid #28a745;
}

/* Style form actions */
.form-actions {
    margin-top: 20px;
}

.form-actions input[type="submit"] {
    background-color: #0073aa;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
}

.form-actions input[type="submit"]:hover {
    background-color: #005d82;
}

.form-actions .cancel-button {
    background-color: #6c757d;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.form-actions .cancel-button:hover {
    background-color: #5a6268;
}

/* Style success message */
.success-message {
    margin: 20px 20px 0;
    padding: 10px;
    background-color: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
    border-radius: 4px;
}

/* Salary Sheet Report Styles */
.salary-sheet-report {
    margin: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.report-header {
    text-align: center;
    margin-bottom: 20px;
}

.report-header h1 {
    font-size: 1.8em;
    margin: 0;
}

.report-header h2 {
    font-size: 1.3em;
    margin: 10px 0 0;
}

.month-filter {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.month-filter label {
    margin-right: 10px;
    font-weight: 600;
}

.month-filter input[type="month"],
.month-filter button {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.month-filter button {
    background: #0073aa;
    color: #fff;
    border: none;
    cursor: pointer;
    margin-left: 10px;
}

.month-filter button:hover {
    background: #005d82;
}

.salary-sheet-report h3 {
    margin: 20px 0 10px;
    font-size: 1.2em;
}

.salary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.salary-table th,
.salary-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.salary-table th {
    background: #e9ecef;
    font-weight: 600;
}

.salary-table td:nth-child(2),
.salary-table td:nth-child(3) {
    text-align: right;
}

.salary-table th:nth-child(1),
.salary-table td:nth-child(1) {
    width: 40%;
}

.salary-table th:nth-child(2),
.salary-table td:nth-child(2) {
    width: 10%;
}

.salary-table th:nth-child(3),
.salary-table td:nth-child(3) {
    width: 15%;
}

.salary-table th:nth-child(4),
.salary-table td:nth-child(4) {
    width: 15%;
}

.salary-table th:nth-child(5),
.salary-table td:nth-child(5) {
    width: 20%;
}