/* ==========================================================================
   Site-wide styles — Nitta Rundvirke
   Reusable classes for pages, grids, forms, and buttons.
   ========================================================================== */

/* --- Base typography --- */
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9375rem;
    color: #1e293b;
    line-height: 1.5;
    margin: 0;
}

/* --- Login page --- */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 380px;
}

a.mobile-logo {
    display: flex;
}

.login-logo {
    margin-bottom: 2rem;
    text-align: center;
}

.login-logo img {
    width: 50%;
    height: auto;
}

.login-card {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

.login-field {
    margin-bottom: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.login-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.login-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    outline: none;
}

.login-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #4f46e5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
    margin-top: 0.5rem;
}

.login-btn:hover {
    background-color: #4338ca;
}

.login-remember {
    margin-bottom: 1rem;
}

.login-remember label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9375rem;
    color: #475569;
    cursor: pointer;
}

.login-remember input[type="checkbox"] {
    accent-color: #4f46e5;
}

/* --- Page layout --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.page-header h1 {
    font-size: 1.4375rem;
    font-weight: 600;
    margin: 0;
    color: #0f172a;
}

/* --- Data grid --- */
.data-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.9375rem;
}

.data-grid thead th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.625rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}

.data-grid tbody tr {
    transition: background-color 0.1s;
}

.data-grid tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.data-grid tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.data-grid tbody tr:hover {
    background-color: #eef2ff;
}

.data-grid tbody tr.clickable {
    cursor: pointer;
}

.data-grid tbody td {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.data-grid tbody tr:last-child td {
    border-bottom: none;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
    font-size: 1rem;
}

/* --- Loading state --- */
.loading-state {
    padding: 2rem 1rem;
    color: #94a3b8;
    font-size: 0.9375rem;
}

/* --- Forms --- */
.form-panel {
    max-width: 560px;
}

.form-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem 1.25rem 1rem;
    margin-bottom: 1.5rem;
}

.form-group-inline {
    display: flex;
    gap: 1rem;
}

.form-group-inline .form-group {
    flex: 1;
    min-width: 0;
}

.form-group-inline .form-control {
    width: 100%;
}

.form-panel .form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.form-panel .form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.form-panel .form-control,
.form-panel .form-select {
    width: 360px;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 0.9375rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b;
    background-color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-panel .form-control:focus,
.form-panel .form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    outline: none;
}

.form-panel .form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9375rem;
    color: #334155;
}

.form-panel .form-check-label {
    font-size: 0.9375rem;
    font-weight: 400;
    color: #334155;
}

/* --- Buttons --- */
.btn {
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-primary {
    background-color: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.btn-primary:hover {
    background-color: #4338ca;
    border-color: #3730a3;
}

.btn-secondary {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
}

.btn-danger {
    background-color: #e11d48;
    border-color: #e11d48;
    color: #fff;
}

.btn-danger:hover {
    background-color: #be123c;
    border-color: #be123c;
}

/* --- Form actions bar --- */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 0.5rem;
}

/* --- Validation --- */
.validation-message {
    font-size: 0.875rem;
    margin-top: 0.2rem;
}

.validation-summary-errors {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    color: #991b1b;
}

/* --- Week schedule --- */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.week-label {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
    flex: 1;
}

.week-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.week-day {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
}

.week-day:nth-child(even) {
    background: #f8fafc;
}

.week-day:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.week-day.today {
    /*border-left: 3px solid #4f46e5;*/
}

.day-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    color: #94a3b8;
}

.week-day.today .day-icon {
    color: #4f46e5;
}

.day-header {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.day-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    text-transform: capitalize;
}

.day-date {
    font-size: 0.8125rem;
    color: #64748b;
}

.day-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    margin-left: auto;
    flex-shrink: 0;
}

.day-hours {
    font-size: 1rem;
    font-weight: 600;
    color: #4f46e5;
}

.day-count {
    font-size: 0.8125rem;
    color: #94a3b8;
}

.day-empty {
    font-size: 0.875rem;
    color: #cbd5e1;
}

.week-total {
    margin-top: 0.75rem;
    text-align: right;
    font-size: 1rem;
    color: #334155;
}

/* --- Schedule view toggle --- */
.schedule-view-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9375rem;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.schedule-view-toggle input[type="checkbox"] {
    accent-color: #4f46e5;
}

/* --- Monthly view --- */
.month-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 1px;
}

.month-header-cell {
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.5rem 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px 4px 0 0;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    background: #e2e8f0;
}

.month-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    padding: 0.5rem;
    min-height: 70px;
    background: #fff;
    cursor: pointer;
    transition: background-color 0.1s;
}

.month-day:hover {
    background: #eef2ff;
}

.month-day.empty {
    background: #f8fafc;
    cursor: default;
}

.month-day.today {
    border-top: 3px solid #4f46e5;
}

.month-day.selected {
    background: #eef2ff;
    box-shadow: inset 0 0 0 2px #4f46e5;
}

.month-day-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
}

.month-day .day-hours {
    font-size: 0.875rem;
}

.nav-group-icon {
    display: flex;
}

/* --- Day time entries --- */
.entries-heading {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.day-total {
    margin-top: 0.75rem;
    text-align: right;
    font-size: 1rem;
    color: #334155;
}

.btn-remove {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}

.btn-remove:hover {
    background: #fef2f2;
    color: #e11d48;
}

/* --- Report --- */
.report-user-section {
    margin-bottom: 1.5rem;
}

.report-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    border-bottom: none;
}

.report-user-header.clickable {
    cursor: pointer;
    transition: background-color 0.1s;
}

.report-user-header.clickable:hover {
    background: #e2e8f0;
}

.report-user-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.report-user-total {
    font-size: 1rem;
    font-weight: 600;
    color: #4f46e5;
}

.report-grid {
    border-radius: 0 0 8px 8px;
}

.report-total-row td {
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
    padding: 0.5rem 1rem;
}

.report-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.report-detail-user {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

/* --- Report pivot grid --- */
.report-pivot-wrapper {
    overflow-x: auto;
}

.report-pivot-user {
    font-weight: 600;
    white-space: nowrap;
}

.report-pivot-total {
    font-weight: 600;
    color: #4f46e5;
}

/* --- Print styles --- */
@media print {
    .sidebar,
    .page-header .btn,
    .week-nav .btn,
    .report-detail-header .btn,
    .schedule-view-toggle {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
    }

    .data-grid,
    .report-user-section {
        break-inside: avoid;
    }
}

/* --- Dashboard --- */
.dashboard-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #4f46e5;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
}

.dashboard-action-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.15s;
    cursor: pointer;
}

.dashboard-action-card:hover {
    border-color: #4f46e5;
    background: #eef2ff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.dashboard-action-icon {
    width: 32px;
    height: 32px;
    color: #4f46e5;
}

.dashboard-action-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

.dashboard-action-desc {
    font-size: 0.875rem;
    color: #94a3b8;
    text-align: center;
}

/* ==========================================================================
   Responsive — Mobile (<768px)
   ========================================================================== */
@media (max-width: 767.98px) {

    body {
        margin: 0;
        font-size: 1rem;
    }

    /* Prevent iOS Safari auto-zoom on focus — all inputs must be >= 16px */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    /* Forms */
    .form-panel {
        max-width: 100%;
    }

    .form-panel .form-control,
    .form-panel .form-select {
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0.55rem 0.75rem;
        font-size: 16px !important;
    }

    .form-panel .form-label {
        font-size: 0.9375rem;
    }

    .form-actions {
        flex-wrap: wrap;
    }

    .form-actions .btn {
        font-size: 16px !important;
        padding: 0.5rem 1rem;
    }

    /* Buttons */
    .btn {
        font-size: 16px !important;
        padding: 0.45rem 1rem;
    }

    /* Data grid */
    .data-grid {
        font-size: 0.9375rem;
    }

    .data-grid thead th {
        padding: 0.5rem 0.5rem;
        font-size: 0.8125rem;
    }

    .data-grid tbody td {
        padding: 0.45rem 0.5rem;
    }

    /* Report pivot */
    .report-pivot-wrapper {
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    /* Week grid */
    .week-grid {
        gap: 0.35rem;
    }

    .week-day {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .day-icon {
        width: 24px;
        height: 24px;
    }

    .day-name {
        font-size: 0.9375rem;
    }

    .day-date {
        font-size: 0.875rem;
    }

    .day-hours {
        font-size: 0.9375rem;
    }

    .day-count {
        display: none;
    }

    /* Week nav */
    .week-nav {
        gap: 0.25rem;
    }

    .week-nav .btn {
        font-size: 0.9375rem;
        padding: 0.4rem 0.5rem;
    }

    .week-label {
        font-size: 0.9375rem;
    }

    /* Month grid */
    .month-day {
        min-height: 55px;
        padding: 0.35rem;
    }

    .month-day-number {
        font-size: 0.8125rem;
    }

    .month-day .day-hours {
        font-size: 0.8125rem;
    }

    .month-header-cell {
        font-size: 0.75rem;
        padding: 0.35rem 0;
    }

    /* Dashboard */
    .dashboard-stats {
        flex-direction: row;
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.6rem 0.5rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.8125rem;
    }

    .dashboard-actions {
        flex-direction: column;
    }

    .dashboard-action-card {
        padding: 0.75rem 0.5rem;
    }

    .dashboard-action-icon {
        width: 24px;
        height: 24px;
    }

    .dashboard-action-title {
        font-size: 1rem;
    }

    .dashboard-action-desc {
        font-size: 0.8125rem;
    }

    /* Login page */
    .login-input {
        font-size: 16px !important;
        padding: 0.6rem 0.75rem;
    }

    .login-btn {
        font-size: 1rem;
        padding: 0.65rem 1rem;
    }

    .login-field label {
        font-size: 0.9375rem;
    }

    /* Schedule view toggle */
    .schedule-view-toggle {
        font-size: 1rem;
    }

    /* Entries heading */
    .entries-heading {
        font-size: 1.125rem;
    }
}

