/* public/css/zync.css – Zync Designsystem
   Designprincip: enkel, stor text, tydliga knappar – medelålder ~60 år
   Palett: dova.fi-inspirerad (djupblå + vit + varm accent)
*/

/* ── Reset & Grundinställningar ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:      #1a3a5c;   /* Djupblå – från dova.fi */
    --color-primary-dark: #0f2540;
    --color-primary-light:#2d5f8a;
    --color-accent:       #e8a020;   /* Varm gul-orange */
    --color-success:      #2e7d5e;
    --color-error:        #c0392b;
    --color-warning:      #d68910;
    --color-info:         #2471a3;

    --color-bg:           #f4f6f9;
    --color-surface:      #ffffff;
    --color-border:       #d0d7e2;
    --color-text:         #1a1a2e;
    --color-text-muted:   #5a6580;
    --color-text-light:   #8892a4;

    --font-base:    'Segoe UI', Arial, sans-serif;
    --font-size:    18px;       /* Stor grundtext för tillgänglighet */
    --line-height:  1.65;

    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    16px;

    --shadow-sm:    0 1px 4px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 16px rgba(0,0,0,0.10);

    --transition:   0.18s ease;
}

html { font-size: var(--font-size); }

body {
    font-family:      var(--font-base);
    background-color: var(--color-bg);
    color:            var(--color-text);
    line-height:      var(--line-height);
    min-height:       100vh;
    display:          flex;
    flex-direction:   column;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.main-content {
    flex: 1;
    padding: 2rem 0 3rem;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    letter-spacing: -0.5px;
}
.logo-z {
    color: var(--color-accent);
    font-style: italic;
}

.main-nav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}
.main-nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: background var(--transition), color var(--transition);
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
    background: rgba(255,255,255,0.15);
    color: white;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    font-size: 0.9rem;
}
.user-name { color: rgba(255,255,255,0.9); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--color-primary-dark);
    color: rgba(255,255,255,0.65);
    padding: 1.5rem 0;
    font-size: 0.85rem;
    text-align: center;
}
.site-footer a { color: rgba(255,255,255,0.8); }
.site-footer p + p { margin-top: 0.35rem; }

/* ── Knappar ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    font-family: var(--font-base);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), box-shadow var(--transition), transform 0.1s;
    white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary  { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-light); }

.btn-secondary { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-secondary:hover { background: var(--color-primary); color: white; }

.btn-success  { background: var(--color-success); color: white; }
.btn-danger   { background: var(--color-error);   color: white; }
.btn-ghost    { background: rgba(255,255,255,0.1); color: white; border-color: rgba(255,255,255,0.3); }
.btn-ghost:hover { background: rgba(255,255,255,0.2); }

.btn-sm  { padding: 0.4rem 0.9rem; font-size: 0.875rem; }
.btn-lg  { padding: 0.9rem 1.8rem; font-size: 1.1rem; }
.btn-full { width: 100%; }

/* ── Formulär ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.35rem; }
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: var(--color-text);
    font-size: 1rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: var(--font-base);
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: white;
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26,58,92,0.15);
}
.form-hint { font-size: 0.85rem; color: var(--color-text-muted); margin-top: 0.3rem; }

/* OTP-inmatning */
.input-otp {
    font-size: 2rem;
    letter-spacing: 0.5em;
    text-align: center;
    font-weight: 700;
}

/* ── Kort / Panel ────────────────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}
.card-title { font-size: 1.25rem; font-weight: 700; color: var(--color-primary); }

/* ── Aviseringar ─────────────────────────────────────────────────────────── */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 1rem;
    border-left: 4px solid;
}
.alert-success { background: #eaf7f0; color: #1e5c40; border-color: var(--color-success); }
.alert-error   { background: #fdf0ef; color: #7b1d15; border-color: var(--color-error);   }
.alert-info    { background: #eaf3fb; color: #154065; border-color: var(--color-info);    }
.alert-warning { background: #fef9ec; color: #7d5000; border-color: var(--color-warning); }

/* ── Tabeller ────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
th, td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
th { background: var(--color-bg); font-weight: 700; color: var(--color-primary); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: #f0f4f9; }
td a { color: var(--color-primary); font-weight: 600; }

/* ── Märken (badges) ─────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 99px;
    white-space: nowrap;
}
.badge-success  { background: #d4edda; color: #1a5c35; }
.badge-error    { background: #f8d7da; color: #721c24; }
.badge-warning  { background: #fff3cd; color: #856404; }
.badge-info     { background: #d1ecf1; color: #0c5460; }
.badge-neutral  { background: #e2e6ea; color: #495057; }
.badge-mfa      { background: rgba(255,255,255,0.15); color: white; font-size: 0.8rem; }

/* ── Autentiseringssidor ─────────────────────────────────────────────────── */
.auth-page { background: var(--color-primary); min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-container { width: 100%; max-width: 440px; }
.auth-card { background: white; border-radius: var(--radius-lg); padding: 2.5rem 2rem; box-shadow: var(--shadow-md); }
.auth-logo { font-size: 2.5rem; font-weight: 700; color: var(--color-primary); text-align: center; margin-bottom: 0.5rem; }
.auth-title { font-size: 1.6rem; font-weight: 700; color: var(--color-primary); text-align: center; margin-bottom: 0.25rem; }
.auth-subtitle { text-align: center; color: var(--color-text-muted); margin-bottom: 1.75rem; font-size: 0.95rem; }
.auth-link { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; }
.auth-link a { color: var(--color-primary); font-weight: 600; }
.auth-footer-note { color: rgba(255,255,255,0.65); text-align: center; margin-top: 1.5rem; font-size: 0.875rem; }
.auth-footer-note a { color: rgba(255,255,255,0.9); }

/* ── Dashboard – statistikkort ───────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    text-align: center;
}
.stat-value { font-size: 2.4rem; font-weight: 700; color: var(--color-primary); line-height: 1.1; }
.stat-label { font-size: 0.875rem; color: var(--color-text-muted); margin-top: 0.3rem; }

/* ── Sida-titel ───────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.75rem; }
.page-title { font-size: 1.75rem; font-weight: 700; color: var(--color-primary); }
.page-subtitle { color: var(--color-text-muted); margin-top: 0.25rem; }

/* ── Sök ─────────────────────────────────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.search-bar .form-input { flex: 1; }

/* ── Sidnumrering ────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span {
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    text-decoration: none;
}
.pagination .current { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* ── Hjälpklasser ────────────────────────────────────────────────────────── */
.text-muted  { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ── Utskrift (adressetiketter) ──────────────────────────────────────────── */
@media print {
    .site-header, .site-footer, .btn, .main-nav { display: none !important; }
    .labels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
    .label-item { border: 1px solid #ccc; padding: 1cm; font-size: 12pt; page-break-inside: avoid; }
}

/* ── Responsiv ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --font-size: 17px; }
    .header-inner { flex-wrap: wrap; gap: 0.75rem; }
    .main-nav { order: 3; width: 100%; flex-wrap: wrap; }
    .header-user { margin-left: 0; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .search-bar { flex-direction: column; }
    .card { padding: 1.25rem 1rem; }
    th, td { padding: 0.65rem 0.75rem; }
}
@media (max-width: 480px) {
    :root { --font-size: 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-title { font-size: 1.4rem; }
    .auth-card { padding: 1.75rem 1.25rem; }
}
