/* =========================================================
   Global Styles
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
    font-size: 14px;
    line-height: 1.5;
}

/* Default links */
a {
    color: #0ea5e9;
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
    color: #0284c7;
}

/* Utility */

.muted {
    font-size: 12px;
    color: #6b7280;
}

.text-right {
    text-align: right;
}

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

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

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

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */

.app-topbar {
    background: linear-gradient(90deg, #0ea5e9, #0284c7);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.18),
        0 1px 2px rgba(15, 23, 42, 0.15);
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-topbar-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.app-topbar-subtitle {
    font-size: 12px;
    opacity: 0.85;
}

.app-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-topbar-right a {
    color: #e0f2fe;
    text-decoration: none;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-topbar-right a:hover {
    background: rgba(15, 23, 42, 0.28);
}

/* Main area – puna širina ali centrirano */

.app-main {
    padding: 20px;
    margin: 0 auto 30px auto;
    width: 100%;
    max-width: 1300px;
}

/* =========================================================
   Cards
   ========================================================= */

.card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow:
        0 10px 25px rgba(15, 23, 42, 0.06),
        0 1px 3px rgba(15, 23, 42, 0.10);
    margin-bottom: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.card + .card {
    margin-top: 18px;
}

.card-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
}

.card-header:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.01em;
}

.card-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

.card-meta {
    font-size: 12px;
    color: #9ca3af;
}

/* Card varijante */

.card-info {
    border-color: rgba(59, 130, 246, 0.4);
    background: linear-gradient(180deg, #eff6ff, #ffffff);
}

.card-warning {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(180deg, #fffbeb, #ffffff);
}

/* =========================================================
   Buttons
   ========================================================= */

.btn,
.btn-small,
.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        color 0.15s ease,
        transform 0.05s ease,
        border-color 0.15s ease;
}

/* Primarni gumb */

.btn {
    padding: 8px 18px;
    background: #0ea5e9;
    color: #fff;
    box-shadow:
        0 4px 12px rgba(14, 165, 233, 0.4),
        0 1px 1px rgba(15, 23, 42, 0.18);
    border: 1px solid #0ea5e9;
}

.btn:hover {
    background: #0284c7;
    box-shadow:
        0 6px 20px rgba(14, 165, 233, 0.55),
        0 1px 2px rgba(15, 23, 42, 0.22);
    transform: translateY(-1px);
}

/* Sekundarni gumb */

.btn-secondary {
    padding: 7px 16px;
    background: #e5e7eb;
    color: #111827;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #d1d5db;
}

/* Ghost gumb (transparentan, za "Zurück" itd.) */

.btn-ghost {
    padding: 7px 14px;
    background: transparent;
    color: #0f172a;
    border-radius: 999px;
    border: 1px solid #cbd5f5;
}

.btn-ghost:hover {
    background: rgba(226, 232, 240, 0.4);
}

/* Mali gumb */

.btn-small {
    padding: 5px 11px;
    background: #e5e7eb;
    color: #111827;
    margin-right: 6px;
    border: 1px solid #d1d5db;
}

.btn-small:hover {
    background: #d1d5db;
}

/* Danger */

.btn-danger {
    padding: 7px 14px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 999px;
    border: 1px solid #b91c1c;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Logout link kao gumb */

.logout-link {
    padding: 5px 12px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    border: 1px solid #fecaca;
}

.logout-link:hover {
    background: #fecaca;
}

/* =========================================================
   Tables
   ========================================================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

thead {
    background: #f9fafb;
}

th,
td {
    font-size: 13px;
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

th {
    font-weight: 600;
    color: #4b5563;
    text-transform: none;
    letter-spacing: 0.01em;
}

/* Naglasak na hover – lijeva linija boje */

tbody tr {
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

tbody tr:hover {
    background: #f3f4f6;
    box-shadow: inset 3px 0 0 #0ea5e9;
}

/* Kompaktnija tabela */

.table-compact th,
.table-compact td {
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Posebno za dashboard akcije */

.customers-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* =========================================================
   Forms
   ========================================================= */

form {
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group-full {
    grid-column: 1 / -1;
}

label {
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 3px;
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="password"],
textarea {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 7px 9px;
    font-size: 13px;
    background: #f9fafb;
    transition:
        border-color 0.12s ease,
        box-shadow 0.12s ease,
        background 0.12s ease;
}

textarea {
    min-height: 70px;
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(14,165,233,0.25);
}

/* Checkbox / radio */

input[type="checkbox"],
input[type="radio"] {
    accent-color: #0ea5e9;
}

/* =========================================================
   Login
   ========================================================= */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #e0f2fe, #f3f4f6 55%);
}

.login-box {
    background: #ffffff;
    padding: 22px 24px;
    border-radius: 14px;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.13),
        0 1px 2px rgba(15, 23, 42, 0.10);
    width: 320px;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.login-box h2 {
    margin: 0 0 14px 0;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.login-box form input {
    width: 100%;
    margin-bottom: 10px;
}

.login-box button {
    width: 100%;
}

.error {
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    border-radius: 8px;
    padding: 6px 8px;
    margin-bottom: 10px;
    border: 1px solid #fecaca;
}

/* =========================================================
   Skizze & Zonen
   ========================================================= */

.skizze-card {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.skizze {
    position: relative;
    width: 460px;   /* desktop širina */
    border-radius: 12px;
    overflow: hidden;
    background: radial-gradient(circle at top, #f9fafb, #e5e7eb);
    border: 1px solid #e5e7eb;
    box-shadow:
        0 10px 24px rgba(15, 23, 42, 0.12),
        0 1px 2px rgba(15, 23, 42, 0.05);
}

.skizze img {
    width: 100%;
    display: block;
}

/* =========================================================
   BROJEVI NA ZONAMA (GESICHT / KÖRPER)
   ========================================================= */

.csm-dot {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #0ea5e9;
    border: 4px solid #ffffff;
    box-shadow: 0 0 0 2px rgba(14,165,233,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    color: transparent; /* broj se ne prikazuje iz textContent */
}

/* BROJ SE PRIKAZUJE PREKO ::after */
.csm-dot::after {
    content: attr(data-n);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff; /* BIJELA BOJA BROJA */
    pointer-events: none;
}


/* Stare zone klase – ako se još koriste */

.zone {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid #0ea5e9;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(255,255,255,0.9);
    transition:
        background 0.12s ease,
        transform 0.05s ease,
        box-shadow 0.12s ease,
        border-color 0.12s ease;
}

.zone:hover {
    box-shadow: 0 0 0 3px rgba(14,165,233,0.3);
    transform: scale(1.05);
}

.zone.active {
    background: #0ea5e9;
    border-color: #0369a1;
}

.skizze-legend {
    flex: 1;
    font-size: 12px;
    color: #4b5563;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.skizze-legend h3 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 6px 0;
}

.skizze-legend ul {
    margin: 0 0 6px 16px;
    padding: 0;
}

.skizze-legend li {
    margin-bottom: 2px;
}

.skizze-selected {
    margin-top: 8px;
    font-size: 12px;
    color: #4b5563;
}

/* =========================================================
   Badges
   ========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 11px;
    padding: 2px 8px;
    background: #e5e7eb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.badge-warning {
    background: #fef9c3;
    color: #92400e;
    border-color: #facc15;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* =========================================================
   Alerts
   ========================================================= */

.alert {
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    margin-bottom: 10px;
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.alert-warning {
    background: #fef9c3;
    color: #92400e;
    border: 1px solid #facc15;
}

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

/* Tablet */

@media (max-width: 1024px) {
    .app-main {
        padding: 16px;
        max-width: 100%;
    }
}

/* Mobile */

@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    .app-main {
        padding: 12px;
        margin-bottom: 20px;
        max-width: 100%;
    }

    .card {
        padding: 12px 12px;
        border-radius: 12px;
        margin-bottom: 14px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .card-title {
        font-size: 16px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px 0;
    }

    .form-group,
    .form-group-full {
        width: 100%;
    }

    /* Skizze full width */
    .skizze-card {
        flex-direction: column;
    }

    .skizze {
        width: 100%;
    }

    .table-wrap {
        margin: 0;
        padding: 0;
        overflow-x: visible;
    }

    /* CUSTOMERS & BEHANDLUNGEN TABLE → CARD LAYOUT */
    .customers-table,
    .behandlungen-table {
        border-radius: 0;
        border: none;
        background: transparent;
    }

    .customers-table thead,
    .behandlungen-table thead {
        display: none;
    }

    .customers-table,
    .customers-table tbody,
    .customers-table tr,
    .customers-table td,
    .behandlungen-table,
    .behandlungen-table tbody,
    .behandlungen-table tr,
    .behandlungen-table td {
        display: block;
        width: 100%;
    }

    .customers-table tr,
    .behandlungen-table tr {
        margin-bottom: 10px;
        padding: 10px 10px;
        border-radius: 12px;
        background: #ffffff;
        box-shadow:
            0 6px 16px rgba(15, 23, 42, 0.08),
            0 1px 2px rgba(15, 23, 42, 0.05);
        border: 1px solid #e5e7eb;
    }

    .customers-table td,
    .behandlungen-table td {
        border-bottom: none;
        padding: 4px 0;
        font-size: 13px;
        white-space: normal;
        word-break: break-word;
    }

    .customers-table td::before,
    .behandlungen-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 600;
        color: #6b7280;
        margin-bottom: 1px;
        text-transform: none;
    }

    .customers-actions {
        margin-top: 4px;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 4px;
    }

    .app-topbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .app-topbar-title {
        font-size: 16px;
    }

    .app-topbar-right {
        width: 100%;
        justify-content: flex-end;
        gap: 4px;
    }

    .app-topbar-right a {
        padding: 4px 8px;
        font-size: 12px;
    }

    .btn,
    .btn-secondary,
    .btn-ghost,
    .btn-danger {
        font-size: 12px;
        padding-top: 6px;
        padding-bottom: 6px;
    }
}
