/* ========================================
   STAFFCLOCK DESIGN SYSTEM
======================================== */

:root {
    color-scheme: light;

    --background: #f5f4f8;
    --background-soft: #eceaf3;

    --surface: #ffffff;
    --surface-light: #f1eff6;
    --surface-hover: #e9e6f1;

    --primary: #7b5de3;
    --primary-light: #9275ed;
    --primary-dark: #6245c7;

    --success: #36a85d;
    --danger: #dc5363;
    --warning: #d8a72e;

    --text: #171421;
    --text-secondary: #716d7c;
    --text-muted: #9994a3;

    --border: rgba(20, 16, 35, .09);

    --clock-disabled: #ececf2;
    --clock-disabled-text: #a8a5af;

    --radius-small: 12px;
    --radius-medium: 20px;
    --radius-large: 30px;

    --shadow:
        0 20px 60px rgba(31, 24, 55, .10);

    --nav-background:
        rgba(255, 255, 255, .94);
}


/* ========================================
   SYSTEM DARK MODE
======================================== */

@media (prefers-color-scheme: dark) {

    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --background: #100b28;
        --background-soft: #171130;

        --surface: #201a3a;
        --surface-light: #292247;
        --surface-hover: #30284f;

        --primary: #a98cff;
        --primary-light: #cbbcff;
        --primary-dark: #7b5de3;

        --success: #50c878;
        --danger: #ff6b7a;
        --warning: #f4c95d;

        --text: #ffffff;
        --text-secondary: #bbb5cc;
        --text-muted: #817a97;

        --border: rgba(255, 255, 255, .08);

        --clock-disabled: #252c3c;
        --clock-disabled-text: #737988;

        --shadow:
            0 20px 60px rgba(0, 0, 0, .25);

        --nav-background:
            rgba(32, 26, 58, .96);
    }
}


/* ========================================
   FORCED DARK
======================================== */

:root[data-theme="dark"] {
    color-scheme: dark;

    --background: #100b28;
    --background-soft: #171130;

    --surface: #201a3a;
    --surface-light: #292247;
    --surface-hover: #30284f;

    --primary: #a98cff;
    --primary-light: #cbbcff;
    --primary-dark: #7b5de3;

    --success: #50c878;
    --danger: #ff6b7a;
    --warning: #f4c95d;

    --text: #ffffff;
    --text-secondary: #bbb5cc;
    --text-muted: #817a97;

    --border: rgba(255, 255, 255, .08);

    --clock-disabled: #252c3c;
    --clock-disabled-text: #737988;

    --shadow:
        0 20px 60px rgba(0, 0, 0, .25);

    --nav-background:
        rgba(32, 26, 58, .96);
}


/* ========================================
   FORCED LIGHT
======================================== */

:root[data-theme="light"] {
    color-scheme: light;

    --background: #f5f4f8;
    --background-soft: #eceaf3;

    --surface: #ffffff;
    --surface-light: #f1eff6;
    --surface-hover: #e9e6f1;

    --primary: #7b5de3;
    --primary-light: #9275ed;
    --primary-dark: #6245c7;

    --success: #36a85d;
    --danger: #dc5363;
    --warning: #d8a72e;

    --text: #171421;
    --text-secondary: #716d7c;
    --text-muted: #9994a3;

    --border: rgba(20, 16, 35, .09);

    --clock-disabled: #ececf2;
    --clock-disabled-text: #a8a5af;

    --shadow:
        0 20px 60px rgba(31, 24, 55, .10);

    --nav-background:
        rgba(255, 255, 255, .94);
}


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

* {
    box-sizing: border-box;
}


html {
    -webkit-text-size-adjust: 100%;
}


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

    background:
        radial-gradient(
            circle at top,
            var(--background-soft) 0,
            var(--background) 42%
        );

    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
}


button,
input {
    font: inherit;
}


button,
a {
    -webkit-tap-highlight-color: transparent;
}


.app-shell {
    min-height: 100vh;
}


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

.login-page {
    width: min(100%, 460px);
    min-height: 100vh;

    margin: 0 auto;

    padding:
        max(60px, env(safe-area-inset-top))
        24px
        max(30px, env(safe-area-inset-bottom));

    display: flex;
    flex-direction: column;
    justify-content: center;
}


.login-brand {
    text-align: center;
    margin-bottom: 34px;
}


.brand-mark {
    width: 72px;
    height: 72px;

    margin: 0 auto 18px;

    display: grid;
    place-items: center;

    border-radius: 24px;

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

    color: #ffffff;

    box-shadow:
        0 15px 40px rgba(123, 93, 227, .25);

    font-size: 23px;
    font-weight: 800;
}


.login-brand h1 {
    margin: 0;

    font-size: clamp(32px, 8vw, 42px);

    letter-spacing: -1.4px;
}


.login-brand p {
    margin: 10px 0 0;

    color: var(--text-secondary);

    font-size: 16px;
}


.login-card {
    padding: 30px;

    background: var(--surface);

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

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


.login-heading {
    margin-bottom: 26px;
}


.login-heading h2 {
    margin: 0 0 6px;

    font-size: 25px;

    letter-spacing: -.5px;
}


.login-heading p {
    margin: 0;

    color: var(--text-secondary);
}


.form-group {
    margin-bottom: 20px;
}


.form-group label {
    display: block;

    margin-bottom: 9px;

    color: var(--text);

    font-size: 14px;
    font-weight: 600;
}


.login-form input {
    width: 100%;
    min-height: 54px;

    padding: 0 16px;

    color: var(--text);

    background: var(--surface-light);

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

    outline: none;

    font-size: 16px;

    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}


.login-form input::placeholder {
    color: var(--text-muted);
}


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

    box-shadow:
        0 0 0 4px rgba(123, 93, 227, .12);
}


.password-field {
    position: relative;
}


.password-field input {
    padding-right: 70px;
}


.password-toggle {
    position: absolute;

    right: 9px;
    top: 50%;

    transform: translateY(-50%);

    padding: 9px;

    color: var(--primary);

    background: transparent;

    border: 0;

    cursor: pointer;

    font-size: 13px;
    font-weight: 700;
}


.primary-button {
    width: 100%;
    min-height: 56px;

    margin-top: 8px;

    border: 0;
    border-radius: 15px;

    color: #ffffff;

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

    cursor: pointer;

    font-size: 16px;
    font-weight: 800;

    transition:
        transform .15s ease,
        opacity .15s ease;
}


.primary-button:active {
    transform: scale(.985);
}


.alert {
    padding: 13px 15px;

    margin-bottom: 22px;

    border-radius: 12px;

    font-size: 14px;
}


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

    background: rgba(220, 83, 99, .10);

    border:
        1px solid rgba(220, 83, 99, .25);
}


.login-security {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 8px;

    margin-top: 24px;

    color: var(--text-muted);

    font-size: 13px;
}


.security-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: var(--success);
}


.login-footer {
    margin-top: 28px;

    display: flex;

    justify-content: center;

    gap: 8px;

    color: var(--text-muted);

    font-size: 12px;
}


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

.mobile-app {
    width: min(100%, 600px);
    min-height: 100vh;

    margin: 0 auto;

    padding:
        max(28px, env(safe-area-inset-top))
        20px
        calc(110px + env(safe-area-inset-bottom));
}


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

.app-header {
    min-height: 70px;

    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;

    gap: 12px;

    margin-bottom: 24px;
}


.user-avatar {
    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    border-radius: 50%;

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

    color: #ffffff;
    text-decoration: none;

    font-weight: 800;

    cursor: pointer;
}


.location-selector {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 8px;

    font-size: 21px;
    font-weight: 750;
}


.chevron {
    color: var(--text-secondary);
}


.appearance-wrapper {
    position: relative;
}


.header-action {
    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    padding: 0;

    color: var(--text);

    background: transparent;

    border: 0;
    border-radius: 50%;

    cursor: pointer;

    font-size: 18px;
    font-weight: 800;
}


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

.appearance-menu[hidden] {
    display: none;
}


.appearance-menu {
    position: absolute;

    z-index: 100;

    top: 52px;
    right: 0;

    width: 210px;

    padding: 9px;

    background: var(--surface);

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

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


.appearance-title {
    padding: 8px 10px 10px;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: .6px;
}


.theme-option {
    width: 100%;
    min-height: 48px;

    display: grid;

    grid-template-columns: 25px 1fr 22px;

    align-items: center;

    gap: 8px;

    padding: 0 10px;

    border: 0;
    border-radius: 12px;

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

    text-align: left;

    cursor: pointer;
}


.theme-option:active {
    background: var(--surface-hover);
}


.theme-symbol {
    text-align: center;
}


.theme-check {
    visibility: hidden;

    color: var(--primary);

    font-weight: 800;
}


.theme-option.selected {
    background: var(--surface-light);
}


.theme-option.selected .theme-check {
    visibility: visible;
}


/* ========================================
   CLOCK CARD
======================================== */

.clock-card {
    padding: 34px 24px 25px;

    margin-bottom: 22px;

    text-align: center;

    background: var(--surface);

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

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


.live-clock {
    font-size:
        clamp(58px, 17vw, 82px);

    line-height: 1;

    font-weight: 800;

    letter-spacing: -4px;
}


.live-date {
    min-height: 19px;

    margin-top: 12px;

    color: var(--text-secondary);

    font-size: 15px;
}


.shift-status {
    margin: 30px 0 20px;

    color: var(--text-secondary);

    font-size: 20px;
    font-weight: 700;
}


.clock-button {
    width: 100%;
    min-height: 58px;

    border: 0;
    border-radius: 15px;

    background: var(--success);

    color: #ffffff;

    font-size: 18px;
    font-weight: 800;

    cursor: pointer;
}


.clock-button:disabled {
    background: var(--clock-disabled);

    color: var(--clock-disabled-text);

    cursor: not-allowed;
}


.gps-status {
    margin-top: 18px;

    display: flex;

    justify-content: center;
    align-items: center;

    gap: 8px;

    color: var(--text-secondary);

    font-size: 13px;
}


.status-dot {
    width: 9px;
    height: 9px;

    border-radius: 50%;
}


.status-dot.warning {
    background: var(--warning);
}


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

.dashboard-card {
    margin-bottom: 20px;

    padding: 22px;

    background: var(--surface);

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

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


.card-heading {
    display: flex;

    align-items: center;

    gap: 15px;

    padding-bottom: 18px;
}


.card-heading h2 {
    margin: 0;

    font-size: 21px;
}


.card-heading p {
    margin: 4px 0 0;

    color: var(--text-secondary);

    font-size: 13px;
}


.card-icon {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    flex: 0 0 auto;

    border-radius: 13px;

    background:
        rgba(54, 168, 93, .14);

    color: var(--success);

    font-size: 21px;
}


.card-icon.secondary {
    background:
        rgba(123, 93, 227, .14);

    color: var(--primary);
}


.empty-row {
    padding: 20px 0;

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

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

    color: var(--text-secondary);
}


.menu-row {
    min-height: 57px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    color: var(--text);

    text-decoration: none;

    font-weight: 600;

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


.menu-row:last-child {
    border-bottom: 0;
}


.menu-row span:last-child {
    color: var(--text-muted);

    font-size: 30px;

    font-weight: 300;
}


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

.attendance-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 10px;

    padding-top: 18px;

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


.attendance-grid div {
    min-width: 0;
}


.attendance-grid span {
    display: block;

    margin-bottom: 7px;

    color: var(--text-secondary);

    font-size: 12px;
}


.attendance-grid strong {
    font-size: 17px;
}


/* ========================================
   BOTTOM NAVIGATION
======================================== */

.bottom-nav {
    position: fixed;

    z-index: 20;

    left: 50%;
    bottom:
        max(14px, env(safe-area-inset-bottom));

    transform:
        translateX(-50%);

    width:
        min(calc(100% - 30px), 560px);

    min-height: 74px;

    padding: 8px;

    display: grid;

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

    background:
        var(--nav-background);

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

    border-radius: 27px;

    box-shadow:
        0 15px 50px rgba(0, 0, 0, .18);

    -webkit-backdrop-filter:
        blur(18px);

    backdrop-filter:
        blur(18px);
}


.nav-item {
    min-width: 0;
    min-height: 57px;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 4px;

    border-radius: 20px;

    color: var(--text-secondary);

    text-decoration: none;

    font-size: 11px;
    font-weight: 700;
}


.nav-item.active {
    background:
        rgba(123, 93, 227, .14);

    color: var(--primary);
}


.nav-icon {
    font-size: 22px;
}


.page-spacer {
    height: 20px;
}


/* ========================================
   ACCOUNT PAGE
======================================== */

.page-header {
    min-height: 70px;

    display: grid;

    grid-template-columns:
        50px 1fr 50px;

    align-items: center;

    margin-bottom: 24px;
}


.page-header h1 {
    margin: 0;

    text-align: center;

    font-size: 25px;
}


.back-button {
    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: var(--surface-light);

    color: var(--text);

    text-decoration: none;

    font-size: 34px;
}


.profile-card {
    display: flex;

    align-items: center;

    gap: 18px;

    padding: 24px;

    margin-bottom: 20px;

    background: var(--surface);

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

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

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


.profile-avatar {
    width: 64px;
    height: 64px;

    flex: 0 0 auto;

    display: grid;
    place-items: center;

    border-radius: 50%;

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

    color: #ffffff;

    font-size: 23px;
    font-weight: 800;
}


.profile-details {
    min-width: 0;
}


.profile-details h2 {
    margin: 0 0 5px;

    font-size: 21px;
}


.profile-details p {
    margin: 0 0 10px;

    color: var(--text-secondary);

    font-size: 13px;

    overflow-wrap: anywhere;
}


.role-badge {
    display: inline-block;

    padding: 5px 10px;

    border-radius: 20px;

    background: var(--surface-light);

    color: var(--primary);

    font-size: 12px;
    font-weight: 700;
}


.account-row {
    min-height: 72px;

    display: flex;

    align-items: center;
    justify-content: space-between;

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


.account-row:last-child {
    border-bottom: 0;
}


.account-row strong {
    display: block;
}


.account-row div > span {
    display: block;

    margin-top: 4px;

    color: var(--text-secondary);

    font-size: 13px;
}


.account-row > span {
    color: var(--text-muted);

    font-size: 28px;
}


.logout-form {
    margin-top: 4px;
}


.logout-button {
    width: 100%;
    min-height: 58px;

    border:
        1px solid rgba(220, 83, 99, .25);

    border-radius: 16px;

    background:
        rgba(220, 83, 99, .10);

    color: var(--danger);

    font-size: 17px;
    font-weight: 750;

    cursor: pointer;
}


/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 480px) {

    .login-page {
        padding-left: 20px;
        padding-right: 20px;
    }


    .login-card {
        padding: 25px 21px;
    }


    .mobile-app {
        padding-left: 16px;
        padding-right: 16px;
    }


    .dashboard-card {
        padding: 20px;
    }

}


@media (min-width: 900px) {

    .login-page {
        width: 480px;
    }

}


@media (hover: hover) and (pointer: fine) {

    .theme-option:hover,
    .menu-row:hover,
    .nav-item:hover {
        background: var(--surface-hover);
    }

}

.location-selector select {
    max-width: 220px;

    appearance: none;

    border: 0;

    background: transparent;

    color: var(--text);

    font: inherit;
    font-weight: 750;

    text-align: center;

    outline: none;
}

.selected-site-info {
    margin-top: 24px;

    display: grid;

    gap: 5px;
}

.selected-site-info strong {
    font-size: 18px;
}

.selected-site-info span,
.selected-site-info small {
    color: var(--text-secondary);
}

.selected-site-info span {
    font-size: 13px;
}

.selected-site-info small {
    font-size: 12px;
}


.check-location-button {
    width: 100%;
    min-height: 54px;

    margin-bottom: 12px;

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

    border-radius: 15px;

    background:
        rgba(123, 93, 227, .10);

    color: var(--primary);

    font-size: 16px;
    font-weight: 750;

    cursor: pointer;
}


.check-location-button:disabled {
    opacity: .5;

    cursor: not-allowed;
}


.status-dot.success {
    background: var(--success);
}


.status-dot.danger {
    background: var(--danger);
}
