
/* =====================================================
   QUANTECH ATTENDANCE SYSTEM
   RESPONSIVE UI
   ===================================================== */

:root {
    --primary: #7f1d1d;
    --primary-dark: #5f1515;
    --primary-light: #991b1b;

    --primary-soft: #fef2f2;
    --primary-border: #fecaca;

    --success: #15803d;
    --success-soft: #dcfce7;

    --danger: #b91c1c;
    --danger-soft: #fee2e2;

    --warning: #a16207;
    --warning-soft: #fef3c7;

    --info: #1d4ed8;
    --info-soft: #dbeafe;

    --bg: #f5f6f8;
    --surface: #ffffff;

    --text: #1f2937;
    --text-dark: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    --border: #e5e7eb;
    --border-dark: #d1d5db;

    --shadow-sm:
        0 2px 8px rgba(0, 0, 0, 0.05);

    --shadow:
        0 5px 18px rgba(0, 0, 0, 0.07);

    --shadow-lg:
        0 12px 35px rgba(0, 0, 0, 0.10);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;

    --container-width: 1400px;
}


/* =====================================================
   RESET
===================================================== */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: var(--bg);
    color: var(--text);

    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
}

a {
    color: inherit;
}

::selection {
    background: var(--primary);
    color: #ffffff;
}


/* =====================================================
   HEADER
===================================================== */

header {
    width: 100%;

    background:
        linear-gradient(
            135deg,
            var(--primary-dark),
            var(--primary)
        );

    color: #ffffff;

    padding: 18px 30px;

    box-shadow:
        0 3px 14px rgba(0, 0, 0, 0.14);

    position: relative;
    z-index: 100;
}

.header-content {
    width: 100%;
    max-width: var(--container-width);

    margin: 0 auto;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 30px;
}

.header-brand {
    min-width: 0;
}

.header-brand h1 {
    margin: 0;

    font-size: 24px;

    font-weight: 700;

    line-height: 1.2;
}

.header-brand p {
    margin: 6px 0 0;

    color: #fecaca;

    font-size: 14px;
}

.user-header-info {
    margin-top: 7px;

    display: flex;

    align-items: center;

    gap: 10px;

    flex-wrap: wrap;
}

#headerUserName,
#headerUserRole {
    font-size: 13px;

    font-weight: 600;
}

#headerUserName {
    color: #ffffff;
}

#headerUserRole {
    color: #fecaca;
}

#headerUserRole::before {
    content: "•";

    margin-right: 7px;

    color: #fca5a5;
}

.header-actions {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    flex-shrink: 0;
}

.header-logout {
    white-space: nowrap;
}


/* =====================================================
   MAIN CONTAINER
===================================================== */

.container {
    width: 100%;

    max-width: var(--container-width);

    margin: 0 auto;

    padding: 30px;
}


/* =====================================================
   PAGE SYSTEM
===================================================== */

.page {
    display: none;

    animation:
        pageFade
        0.2s
        ease-in-out;
}

.page.active {
    display: block;
}

@keyframes pageFade {

    from {
        opacity: 0;

        transform:
            translateY(5px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}


/* =====================================================
   PAGE HEADER
===================================================== */

.page-header {
    margin-bottom: 25px;
}

.page-header h2,
.page > h2 {
    margin: 0 0 8px;

    font-size: 28px;

    color: var(--text-dark);

    line-height: 1.25;
}

.page-header p,
.page > p {
    margin: 0;

    color: var(--text-muted);

    font-size: 15px;
}


/* =====================================================
   LOGIN
===================================================== */

.login-page {
    min-height: calc(100vh - 85px);

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 40px 20px;

    background:
        radial-gradient(
            circle at top left,
            #fee2e2 0,
            transparent 45%
        ),
        linear-gradient(
            135deg,
            #fffafa,
            #f5f6f8
        );
}

.login-box {
    width: 100%;

    max-width: 420px;

    background: var(--surface);

    padding: 38px;

    border-radius: 20px;

    border:
        1px solid var(--border);

    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.12);

    text-align: center;
}

.login-box h1 {
    margin: 0 0 10px;

    color: var(--primary);

    font-size: 28px;

    line-height: 1.2;
}

.login-box p {
    margin: 0 0 28px;

    color: var(--text-muted);

    font-size: 14px;
}

.login-box input {
    width: 100%;

    min-height: 48px;

    padding: 13px 15px;

    margin-bottom: 14px;

    border:
        1px solid var(--border-dark);

    border-radius: var(--radius-sm);

    background: #ffffff;

    color: var(--text);

    outline: none;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.login-box input:focus {
    border-color: var(--primary-light);

    box-shadow:
        0 0 0 4px
        rgba(153, 27, 27, 0.10);
}

.login-button {
    width: 100%;
}


/* =====================================================
   CARDS
===================================================== */

.cards {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 20px;

    margin:
        28px
        0
        35px;
}

.card {
    background: var(--surface);

    padding: 23px;

    border:
        1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    min-width: 0;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.card:hover {
    transform:
        translateY(-2px);

    box-shadow: var(--shadow-lg);
}

.card h3 {
    margin: 0 0 20px;

    color: var(--text-dark);

    font-size: 19px;
}

.card-title {
    margin-bottom: 10px;

    color: var(--text-muted);

    font-size: 14px;

    font-weight: 600;
}

.card-value {
    color: var(--primary);

    font-size: 30px;

    font-weight: 700;

    line-height: 1.2;

    word-break: break-word;
}


/* =====================================================
   MENU
===================================================== */

.menu {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 15px;

    margin-top: 20px;
}

.menu button {
    min-height: 72px;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 10px;

    text-align: center;
}

.menu button i {
    font-size: 18px;
}


/* =====================================================
   BUTTONS
===================================================== */

button {
    padding: 13px 18px;

    border-radius: var(--radius-sm);

    background: #ffffff;

    color: var(--text);

    box-shadow: var(--shadow-sm);

    cursor: pointer;

    font-size: 14px;

    font-weight: 600;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

button:hover {
    background: var(--primary-soft);

    color: var(--primary);

    transform:
        translateY(-1px);

    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.09);
}

button:active {
    transform:
        translateY(0);
}

button:disabled {
    opacity: 0.5;

    cursor: not-allowed;

    transform: none;

    box-shadow: none;
}

button i {
    pointer-events: none;
}


/* =====================================================
   PRIMARY BUTTON
===================================================== */

.primary {
    background: var(--primary-light);

    color: #ffffff;
}

.primary:hover {
    background: var(--primary);

    color: #ffffff;
}


/* =====================================================
   DANGER BUTTON
===================================================== */

.danger {
    background: var(--danger);

    color: #ffffff;
}

.danger:hover {
    background: var(--primary-dark);

    color: #ffffff;
}


/* =====================================================
   BACK BUTTON
===================================================== */

.back {
    display: inline-flex;

    align-items: center;

    gap: 8px;

    margin-bottom: 25px;

    background: var(--primary);

    color: #ffffff;

    box-shadow:
        0 4px 12px
        rgba(127, 29, 29, 0.20);
}

.back:hover {
    background: var(--primary-light);

    color: #ffffff;
}


/* =====================================================
   LOGOUT
===================================================== */

.logout-button {
    background:
        rgba(255, 255, 255, 0.95);

    color: var(--primary);

    border:
        1px solid var(--primary-border);

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.08);
}

.logout-button:hover {
    background: #ffffff;

    color: var(--primary-dark);
}


/* =====================================================
   STATUS
===================================================== */

.status {
    margin: 18px 0;

    padding: 14px 16px;

    background: var(--surface);

    border:
        1px solid var(--border);

    border-radius: var(--radius-sm);

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.04);
}

.status strong {
    font-weight: 700;
}

.status.success {
    color: var(--success);

    background: var(--success-soft);

    border-color: #bbf7d0;
}

.status.error {
    color: var(--danger);

    background: var(--danger-soft);

    border-color: #fecaca;
}

.status.loading {
    color: var(--warning);

    background: var(--warning-soft);

    border-color: #fde68a;
}


/* =====================================================
   SYSTEM STATUS
===================================================== */

#systemStatus {
    font-weight: 700;
}

#systemStatus.success {
    color: var(--success);
}

#systemStatus.error {
    color: var(--danger);
}

#systemStatus.loading {
    color: var(--warning);
}


/* =====================================================
   FORMS
===================================================== */

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 20px;
}

.form-group {
    display: flex;

    flex-direction: column;

    gap: 7px;
}

.form-group label {
    color: var(--text-dark);

    font-size: 14px;

    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;

    min-height: 46px;

    padding: 12px 14px;

    border:
        1px solid var(--border-dark);

    border-radius: var(--radius-sm);

    background: #ffffff;

    color: var(--text);

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-light);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-light);

    box-shadow:
        0 0 0 4px
        rgba(153, 27, 27, 0.10);
}

select {
    cursor: pointer;
}

textarea {
    resize: vertical;

    min-height: 100px;
}

input[type="file"] {
    min-height: auto;

    padding: 12px;

    margin:
        15px
        0;

    background: #ffffff;

    cursor: pointer;
}


/* =====================================================
   BRANCH PAGE
===================================================== */

#branchesPage .card {
    margin-bottom: 25px;
}

#branchesPage .page-header {
    margin-bottom: 25px;
}

#branchesPage .form-grid {
    margin-bottom: 20px;
}

#branchActivationResult {
    border-left:
        4px solid
        var(--success);
}

#managerActivationLink {
    font-size: 13px;

    line-height: 1.5;
}


/* =====================================================
   TABLE CONTAINER
===================================================== */

.table-container {
    width: 100%;

    overflow-x: auto;

    background: var(--surface);

    border:
        1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow);

    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;

    min-width: 700px;

    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;

    border-bottom:
        1px solid var(--border);

    text-align: left;

    white-space: nowrap;
}

th {
    background: var(--primary);

    color: #ffffff;

    font-size: 13px;

    font-weight: 700;

    letter-spacing: 0.01em;
}

td {
    color: var(--text);

    font-size: 14px;

    background: #ffffff;
}

tbody tr:hover td {
    background:
        var(--primary-soft);
}

tr:last-child td {
    border-bottom: none;
}


/* =====================================================
   TABLE STATUS CELLS
===================================================== */

td.success {
    color: var(--success);

    font-weight: 700;
}

td.error {
    color: var(--danger);

    font-weight: 700;
}


/* =====================================================
   SCHEDULE TABLE
===================================================== */

.schedule-table {
    min-width: 900px;
}

.schedule-table th,
.schedule-table td {
    text-align: center;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
    position: sticky;

    left: 0;

    z-index: 5;
}

.schedule-table th:first-child {
    background: var(--primary);
}

.schedule-table td:first-child {
    background: #ffffff;

    font-weight: 700;

    box-shadow:
        2px 0 6px
        rgba(0, 0, 0, 0.06);
}


/* =====================================================
   SHIFT TYPES
===================================================== */

.shift-AM {
    background: var(--success-soft) !important;

    color: #166534 !important;

    font-weight: 700;
}

.shift-PM {
    background: var(--info-soft) !important;

    color: #1e40af !important;

    font-weight: 700;
}

.shift-Support {
    background: var(--warning-soft) !important;

    color: #92400e !important;

    font-weight: 700;
}

.shift-OFF {
    background: #f3f4f6 !important;

    color: #4b5563 !important;

    font-weight: 700;
}

.shift-Annual {
    background: var(--danger-soft) !important;

    color: var(--primary) !important;

    font-weight: 700;
}


/* =====================================================
   ATTENDANCE
===================================================== */

#attendancePage .cards {
    margin-top: 0;
}

#attendancePage #attendanceActions {
    grid-template-columns:
        repeat(
            2,
            minmax(
                0,
                220px
            )
        );

    justify-content: start;
}

#checkInButton,
#checkOutButton {
    color: #ffffff;
}

#checkInButton {
    background: var(--success);
}

#checkInButton:hover {
    background: #166534;

    color: #ffffff;
}

#checkOutButton {
    background: var(--danger);
}

#checkOutButton:hover {
    background: var(--primary);

    color: #ffffff;
}

#attendanceDataCard {
    margin-top: 25px;
}


/* =====================================================
   IMPORT PAGE
===================================================== */

#importPage .status {
    margin-bottom: 20px;
}

#importPage .status p {
    margin:
        7px
        0;
}

#excelPreview {
    margin-top: 20px;
}


/* =====================================================
   REPORTS / SETTINGS
===================================================== */

#reportsPage .card,
#settingsPage .card {
    max-width: 900px;
}

#reportsPage h3,
#settingsPage h3 {
    color: var(--primary);

    margin-top: 0;
}


/* =====================================================
   FOOTER
===================================================== */

footer {
    width: 100%;

    margin-top: 20px;

    padding: 25px 15px;

    text-align: center;

    color: var(--text-muted);

    font-size: 13px;

    border-top:
        1px solid var(--border);

    background: #ffffff;
}


/* =====================================================
   LARGE TABLETS
===================================================== */

@media (max-width: 1100px) {

    .container {
        padding: 25px;
    }

    .cards {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .menu {
        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );
    }

}


/* =====================================================
   TABLETS
===================================================== */

@media (max-width: 850px) {

    header {
        padding:
            17px
            20px;
    }

    .header-content {
        gap: 20px;
    }

    .header-brand h1 {
        font-size: 21px;
    }

    .container {
        padding:
            22px
            17px;
    }

    .form-grid {
        grid-template-columns:
            1fr;
    }

    .menu {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .menu button {
        min-height: 64px;
    }

    .card {
        padding: 19px;
    }

    .card-value {
        font-size: 26px;
    }

    .page-header h2,
    .page > h2 {
        font-size: 25px;
    }

}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 600px) {

    header {
        padding:
            15px;
    }

    .header-content {
        align-items: flex-start;

        flex-direction: column;

        gap: 15px;
    }

    .header-actions {
        width: 100%;

        justify-content: flex-end;
    }

    .header-logout {
        width: auto;
    }

    .header-brand h1 {
        font-size: 19px;
    }

    .header-brand p {
        font-size: 13px;
    }

    .container {
        padding:
            17px
            12px;
    }

    .cards {
        grid-template-columns:
            1fr;

        gap: 12px;

        margin:
            20px
            0
            25px;
    }

    .menu {
        grid-template-columns:
            1fr;

        gap: 10px;
    }

    .menu button {
        width: 100%;

        min-height: 58px;
    }

    #attendancePage #attendanceActions {
        grid-template-columns:
            1fr;
    }

    .card {
        padding: 17px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h2,
    .page > h2 {
        font-size: 22px;
    }

    .back {
        width: 100%;

        justify-content: center;

        margin-bottom: 18px;
    }

    .login-page {
        min-height: calc(100vh - 70px);

        padding:
            20px
            12px;
    }

    .login-box {
        padding:
            28px
            20px;

        border-radius:
            16px;
    }

    .login-box h1 {
        font-size: 24px;
    }

    .status {
        padding:
            12px
            14px;
    }

    th,
    td {
        padding:
            11px
            12px;
    }

    table {
        min-width: 650px;
    }

    footer {
        padding:
            20px
            12px;
    }

}


/* =====================================================
   VERY SMALL DEVICES
===================================================== */

@media (max-width: 380px) {

    .container {
        padding:
            14px
            9px;
    }

    .login-box {
        padding:
            23px
            16px;
    }

    .card {
        padding: 15px;
    }

    .card-value {
        font-size: 23px;
    }

    button {
        padding:
            12px;

        font-size: 13px;
    }

    input,
    select,
    textarea {
        min-height: 44px;

        padding:
            10px
            12px;
    }

}


/* =====================================================
   ACCESSIBILITY
===================================================== */

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline:
        3px solid
        rgba(153, 27, 27, 0.20);

    outline-offset: 2px;
}


/* =====================================================
   REDUCED MOTION
===================================================== */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;
    }

}
/* Dashboard Statistics */

.dashboard-stat-card {
    min-height: 120px;
    padding: 18px 20px;
}

.dashboard-stat-card .card-title {
    font-size: 13px;
    margin-bottom: 8px;
}

.dashboard-stat-card .card-value {
    font-size: 26px;
}

#dashboardPage .cards {
    gap: 14px;
    margin-bottom: 24px;
}

#dashboardPage > h2 {
    font-size: 22px;
    margin-top: 10px;
    margin-bottom: 12px;
}

#dashboardMenu {
    gap: 12px;
    margin-top: 12px;
}

#dashboardMenu button {
    min-height: 58px;
    padding: 12px 14px;
}

/* =====================================================
   SCHEDULE EDITOR
   ===================================================== */

.schedule-editable {
    cursor: pointer;
    user-select: none;
}

.schedule-editable:hover {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

.schedule-shift-select {
    width: 100%;
    min-width: 90px;
    padding: 6px 8px;
    border: 1px solid #999;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
}

.schedule-pending {
    outline: 2px solid #d97706;
    outline-offset: -2px;
}

.schedule-save-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.schedule-save-button {
    padding: 11px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.schedule-save-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =====================================================
   SECURE SESSION LOADING SCREEN
   ===================================================== */

.session-loader {

    position: fixed;

    inset: 0;

    z-index: 99999;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #ffffff;
}


.session-loader-content {

    text-align: center;

    padding: 30px;
}


.session-loader-content h2 {

    margin: 20px 0 8px;

    font-size: 22px;

    font-weight: 700;

    color: #7f1d1d;
}


.session-loader-content p {

    margin: 0;

    font-size: 14px;

    color: #6b7280;
}


/* Spinner */

.loader-spinner {

    width: 46px;

    height: 46px;

    margin: 0 auto;

    border: 4px solid #e5e7eb;

    border-top-color: #7f1d1d;

    border-radius: 50%;

    animation:
        quantechSpin
        0.8s linear infinite;
}


@keyframes quantechSpin {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }

}