/* ==========================================
   Docházka – globální styly
   ========================================== */

:root {
    --doch-primary:       #4f46e5;
    --doch-primary-dark:  #3730a3;
    --doch-sidebar-bg:    #1e1b4b;
    --doch-sidebar-text:  rgba(255,255,255,0.80);
    --doch-sidebar-hover: rgba(255,255,255,0.10);
    --doch-sidebar-active:rgba(255,255,255,0.18);
    --doch-bg:            #f5f6fa;
    --doch-surface:       #ffffff;
    --doch-border:        #e5e7eb;
    --doch-text:          #111827;
    --doch-text-secondary:#6b7280;
    --doch-green:         #15803d;
    --doch-red:           #b91c1c;
    --doch-orange:        #c2410c;
    --doch-purple:        #7c3aed;
    --doch-blue:          #1d4ed8;
}

html, body {
    font-family: 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: var(--doch-bg);
    color: var(--doch-text);
    min-height: 100%;
}

a {
    color: var(--doch-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================
   Layout
   ========================================== */

.app-main-content {
    padding: 80px 28px 32px 28px;
    min-height: 100vh;
}

@media (max-width: 960px) {
    .app-main-content {
        padding: 72px 16px 24px 16px;
    }
}

@media (max-width: 600px) {
    .app-main-content {
        padding: 64px 10px 20px 10px;
    }
}

/* ==========================================
   Sidebar / Drawer
   ========================================== */

.mud-drawer {
    background-color: var(--doch-sidebar-bg) !important;
}

.mud-drawer .mud-nav-link {
    color: var(--doch-sidebar-text) !important;
    border-radius: 8px !important;
    margin: 2px 8px !important;
    padding: 10px 14px !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mud-drawer .mud-nav-link:hover {
    background-color: var(--doch-sidebar-hover) !important;
    color: #fff !important;
}

.mud-drawer .mud-nav-link.active {
    background-color: var(--doch-sidebar-active) !important;
    color: #fff !important;
    font-weight: 600;
}

.mud-drawer .mud-nav-link .mud-icon-root {
    color: var(--doch-sidebar-text) !important;
}

.mud-drawer .mud-nav-link.active .mud-icon-root {
    color: #fff !important;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px 20px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
}

.sidebar-brand-icon {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.38);
    padding: 14px 22px 4px 22px;
}

/* ==========================================
   AppBar
   ========================================== */

.mud-appbar {
    background: var(--doch-sidebar-bg) !important;
}

/* ==========================================
   Karty / Paper
   ========================================== */

.mud-paper {
    border-radius: 12px !important;
}

/* ==========================================
   Formuláře (HTML SSR forms)
   ========================================== */

.doch-form-group {
    margin-bottom: 1rem;
}

.doch-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--doch-text);
    margin-bottom: 6px;
}

.doch-form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--doch-text);
    background-color: var(--doch-surface);
    border: 1px solid var(--doch-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    box-sizing: border-box;
}

.doch-form-control:focus {
    border-color: var(--doch-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.doch-form-control::placeholder {
    color: #9ca3af;
}

.doch-form-select {
    display: block;
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--doch-text);
    background-color: var(--doch-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    border: 1px solid var(--doch-border);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    box-sizing: border-box;
}

.doch-form-select:focus {
    border-color: var(--doch-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.doch-form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.doch-form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid var(--doch-border);
    border-radius: 4px;
    accent-color: var(--doch-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.doch-form-check-label {
    font-size: 0.9375rem;
    color: var(--doch-text);
    cursor: pointer;
}

/* ==========================================
   Docházka – tabulkové styly
   ========================================== */

.attendance-table .mud-table-cell {
    white-space: nowrap;
}

.attendance-row-saturday .mud-table-cell {
    background-color: #eff6ff;
}

.attendance-row-sunday .mud-table-cell {
    background-color: #fff1f2;
}

.attendance-row-holiday .mud-table-cell {
    background-color: #fefce8;
}

.attendance-row-today .mud-table-cell {
    border-top: 2px solid var(--doch-primary) !important;
    border-bottom: 2px solid var(--doch-primary) !important;
    background-color: #eef2ff !important;
}

/* Saldo */

.attendance-saldo-positive {
    color: var(--doch-green);
    font-weight: 700;
}

.attendance-saldo-negative {
    color: var(--doch-red);
    font-weight: 700;
}

.attendance-saldo-zero {
    color: var(--doch-text-secondary);
}

/* Stavy uzávěrek */

.attendance-status-open    { color: var(--doch-blue);   font-weight: 600; }
.attendance-status-returned{ color: var(--doch-orange);  font-weight: 600; }
.attendance-status-sent    { color: var(--doch-purple);  font-weight: 600; }
.attendance-status-closed  { color: var(--doch-green);   font-weight: 600; }

/* ==========================================
   Souhrn karty
   ========================================== */

.attendance-page {
    max-width: 1400px;
    margin: 0 auto;
}

.attendance-summary-card {
    height: 100%;
    border-left: 4px solid var(--doch-primary) !important;
}

.attendance-summary-label {
    font-size: 0.75rem;
    color: var(--doch-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.attendance-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--doch-text);
    line-height: 1.2;
}

/* ==========================================
   Login stránka
   ========================================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.login-logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
}

.login-logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--doch-text);
}

.login-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--doch-text);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--doch-text-secondary);
    margin-bottom: 28px;
}

.login-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--doch-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-align: center;
}

.login-btn:hover {
    background: var(--doch-primary-dark);
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.875rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-forgot {
    text-align: center;
    margin-top: 20px;
    font-size: 0.875rem;
}

/* ==========================================
   Blazor error UI
   ========================================== */

#blazor-error-ui {
    color-scheme: light only;
    background: #fff3cd;
    border-top: 2px solid #f59e0b;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    display: none;
    left: 0;
    padding: 12px 20px;
    position: fixed;
    width: 100%;
    z-index: 9999;
    font-size: 0.9rem;
    box-sizing: border-box;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.6;
}

#blazor-error-ui .dismiss:hover { opacity: 1; }

/* ==========================================
   Validace
   ========================================== */

.valid.modified:not([type=checkbox]) { outline: 1px solid #16a34a; }
.invalid { outline: 1px solid #dc2626; }
.validation-message { color: #dc2626; font-size: 0.8rem; margin-top: 4px; }

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 960px) {
    .mud-table-cell, .mud-table-head-cell {
        font-size: 0.85rem !important;
        padding: 8px 10px !important;
    }
    .attendance-summary-value { font-size: 1.2rem; }
}

@media (max-width: 600px) {
    .mud-paper { border-radius: 8px !important; }
    .attendance-summary-value { font-size: 1rem; }
    .mud-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}
