/* ===== RESET / BASE ===== */

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f6f7f9;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px;
    flex: 1;
}

h1 {
    font-size: 26px;
    margin: 16px 0;
}

h2 {
    font-size: 22px;
    margin-top: 24px;
}

input,
button,
select,
textarea {
    padding: 10px;
    font-size: 16px;
    width: 100%;
}

/* ===== HEADER / NAVIGATION ===== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    padding: 8px;
    width: 100%;
}

.user-info {
    margin-bottom: 8px;
    font-size: 14px;
}

.admin-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #ffc107;
    color: #000;
    font-size: 12px;
    font-weight: bold;
}

.nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
}

.nav-form {
    margin: 0;
}

.nav-btn,
.nav-form .nav-btn {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid #ccc;
    background: white;
    color: black;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.nav-btn:hover {
    background: #eaeaea;
}

.nav-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.nav-btn.logout {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.nav-btn.logout:hover {
    background: #c82333;
}

.nav-btn.admin-leave {
    background: #ffc107;
    color: black;
    border-color: #ffc107;
}

/* ===== BUTTONS ===== */

.primary-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: #007bff;
    color: white;
    cursor: pointer;
}

.primary-btn:hover {
    background: #0069d9;
}

.danger-btn {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.danger-btn:hover {
    background: #c82333;
}

/* ===== FORMS ===== */

.form-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 16px;
    max-width: 520px;
    display: grid;
    gap: 14px;
}

.form-row {
    display: grid;
    gap: 6px;
}

.form-row label {
    font-weight: bold;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-check input {
    width: auto;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.required::after {
    content: " *";
    color: red;
}

/* ===== FEEDBACK ===== */

.error {
    color: #dc3545;
    font-size: 14px;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.error-box {
    background: #f8d7da;
    color: #842029;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* ===== MODAL ===== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    width: calc(100vw - 24px);
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 14px;
    padding: 18px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.modal-close {
    width: auto;
    border: none;
    background: transparent;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.modal form {
    display: grid;
    gap: 10px;
    width: 100%;
    overflow: hidden;
}

.modal input,
.modal select,
.modal textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

/* ===== TABLES ===== */

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th,
td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

th {
    background: #f2f2f2;
}

.row-warning {
    background: #fff3cd;
}

/* ===== SUMMARY / BUTTON ROW ===== */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.summary-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 16px;
}

.summary-label {
    color: #666;
    font-size: 14px;
}

.summary-value {
    font-size: 32px;
    font-weight: bold;
    margin-top: 6px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ===== LOGIN ===== */

.login-page {
    position: relative;
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('/assets/bg-desktop.jpg') no-repeat center center;
    background-size: cover;
    border-radius: 12px;
    overflow: hidden;
}

.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 0;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.45);
    border-radius: 16px;
    padding: 20px;
}

.login-card h1 {
    text-align: center;
    margin-top: 0;
}

.login-form {
    max-width: none;
    background: transparent;
    border: none;
    padding: 0;
}

.muted {
    color: #000;
    text-align: center;
}

/* ===== FOOTER ===== */

.site-footer {
    margin-top: auto;
    background: #1f2937;
    color: rgba(255,255,255,0.85);
    padding: 20px 16px;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
    display: grid;
    gap: 8px;
}

.footer-copy {
    font-size: 14px;
    font-weight: bold;
}

.footer-disclaimer {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255,255,255,0.7);
}

/* ===== MOBILE ===== */

@media (max-width: 700px) {
    .container {
        padding: 12px;
    }

    .nav {
        grid-template-columns: 1fr 1fr;
    }

    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 19px;
    }

    .primary-btn {
        width: 100%;
    }

    .form-card {
        max-width: none;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions button,
    .form-actions a {
        width: 100%;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 12px;
        border: 1px solid #ddd;
        border-radius: 12px;
        background: white;
        padding: 10px;
    }

    td {
        border: none;
        padding: 6px 0;
    }

    td::before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        color: #555;
        margin-bottom: 2px;
    }

    .modal-overlay.open {
        align-items: flex-end;
    }

    .modal {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        border-radius: 16px 16px 0 0;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
    }

    .login-page {
        min-height: calc(100vh - 140px);
        background: url('/assets/bg-mobile.jpg') no-repeat center center;
        background-size: cover;
        border-radius: 0;
    }
}

.row-muted {
    opacity: 0.45;
}

.filter-form {
    margin-bottom: 12px;
}

.filter-form .form-check {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    width: fit-content;
}