/* ============================================================
   DynaMed Thera — Global Stylesheet
   Brand: #61BDAE (Primary Teal), #22353C (Dark), #131F23 (Text)
   Font: Sora
   ============================================================ */

@font-face {
    font-family: 'Sora';
    src: url('fonts/Sora-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables */
:root {
    --color-primary: #61BDAE;
    --color-primary-dark: #4da99a;
    --color-primary-light: #61BDAE30;
    --color-secondary: #22353C;
    --color-secondary-light: #2e4a55;
    --color-text: #131F23;
    --color-text-muted: #6b7a80;
    --color-bg: #F6FAFA;
    --color-bg-card: #FFFFFF;
    --color-border: #ECEFEF;
    --color-border-strong: #cdd4d6;
    --color-white: #FFFFFF;
    --color-danger: #e53e3e;
    --color-warning: #d97706;
    --color-success: #22c55e;
    --color-info: #0693e3;
    --color-gradient-start: #9C00FF;
    --color-gradient-end: #2F88FF;
    --color-cyan: #00C2FF;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(19,31,35,0.08);
    --shadow-md: 0 4px 12px rgba(19,31,35,0.10);
    --shadow-lg: 0 8px 32px rgba(19,31,35,0.12);
    --transition: 0.2s ease;
}

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

html, body {
    font-family: 'Sora', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    height: 100%;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); text-decoration: underline; }

/* ============================================================
   LAYOUT
   ============================================================ */
.dt-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.dt-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--color-secondary);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.dt-sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--topbar-height);
}

.dt-sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dt-sidebar-logo img { width: 24px; height: 24px; filter: brightness(10); }

.dt-sidebar-brand {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dt-sidebar-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-white);
    white-space: nowrap;
    line-height: 1.2;
}

.dt-sidebar-brand-sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--color-primary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 1px;
}

.dt-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.dt-nav-group {
    margin-bottom: 4px;
}

.dt-nav-group-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 20px 4px;
}

.dt-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 13.5px;
    font-weight: 400;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Sora', sans-serif;
}

.dt-nav-item:hover { color: var(--color-white); background: rgba(255,255,255,0.06); text-decoration: none; }

.dt-nav-item.active {
    color: var(--color-primary);
    background: rgba(97, 189, 174, 0.12);
    font-weight: 600;
}

.dt-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

.dt-nav-icon { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
.dt-nav-item.active .dt-nav-icon, .dt-nav-item:hover .dt-nav-icon { opacity: 1; }

.dt-nav-badge {
    margin-left: auto;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.dt-sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.dt-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--border-radius);
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background var(--transition);
}

.dt-user-card:hover { background: rgba(255,255,255,0.08); }

.dt-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.dt-user-info { overflow: hidden; flex: 1; min-width: 0; }
.dt-user-name { font-size: 12.5px; font-weight: 600; color: var(--color-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-user-role { font-size: 10px; color: rgba(255,255,255,0.4); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.dt-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.dt-topbar {
    height: var(--topbar-height);
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.dt-topbar-title { font-size: 18px; font-weight: 600; color: var(--color-text); flex: 1; }

.dt-topbar-search {
    display: flex;
    align-items: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px 12px;
    gap: 8px;
    min-width: 240px;
}

.dt-topbar-search input {
    border: none;
    background: transparent;
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    color: var(--color-text);
    outline: none;
    width: 100%;
}

.dt-topbar-actions { display: flex; align-items: center; gap: 8px; }

.dt-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--color-text-muted);
}

.dt-icon-btn:hover { background: var(--color-bg); color: var(--color-primary); border-color: var(--color-primary); }

.dt-content { flex: 1; padding: 24px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.dt-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.dt-page-header-left { flex: 1; min-width: 0; }
.dt-page-title { font-size: 22px; font-weight: 700; color: var(--color-text); line-height: 1.2; }
.dt-page-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }

.dt-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.dt-breadcrumb a { color: var(--color-text-muted); }
.dt-breadcrumb a:hover { color: var(--color-primary); text-decoration: none; }

/* ============================================================
   CARDS
   ============================================================ */
.dt-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.dt-card-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dt-card-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.dt-card-subtitle { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.dt-card-body { padding: 20px; }
.dt-card-footer { padding: 14px 20px; border-top: 1px solid var(--color-border); background: var(--color-bg); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.dt-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dt-stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.dt-stat-card:hover { box-shadow: var(--shadow-md); }

.dt-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.dt-stat-icon-primary { background: var(--color-primary-light); color: var(--color-primary); }
.dt-stat-icon-secondary { background: rgba(34,53,60,0.1); color: var(--color-secondary); }
.dt-stat-icon-success { background: rgba(34,197,94,0.12); color: var(--color-success); }
.dt-stat-icon-warning { background: rgba(217,119,6,0.12); color: var(--color-warning); }
.dt-stat-icon-danger { background: rgba(229,62,62,0.12); color: var(--color-danger); }
.dt-stat-icon-info { background: rgba(6,147,227,0.12); color: var(--color-info); }

.dt-stat-body { flex: 1; min-width: 0; }
.dt-stat-value { font-size: 26px; font-weight: 700; color: var(--color-text); line-height: 1.1; }
.dt-stat-label { font-size: 12px; color: var(--color-text-muted); margin-top: 3px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.dt-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--border-radius);
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.dt-btn:hover { text-decoration: none; }
.dt-btn-primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.dt-btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: white; }
.dt-btn-secondary { background: var(--color-secondary); color: white; border-color: var(--color-secondary); }
.dt-btn-secondary:hover { background: var(--color-secondary-light); color: white; }
.dt-btn-outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.dt-btn-outline:hover { background: var(--color-primary); color: white; }
.dt-btn-ghost { background: transparent; color: var(--color-text-muted); border-color: var(--color-border); }
.dt-btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.dt-btn-danger { background: var(--color-danger); color: white; border-color: var(--color-danger); }
.dt-btn-sm { padding: 5px 12px; font-size: 12px; }
.dt-btn-lg { padding: 11px 24px; font-size: 15px; }

/* ============================================================
   BADGES
   ============================================================ */
.dt-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.dt-badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.dt-badge-success { background: rgba(34,197,94,0.12); color: #16a34a; }
.dt-badge-warning { background: rgba(217,119,6,0.12); color: var(--color-warning); }
.dt-badge-danger { background: rgba(229,62,62,0.12); color: var(--color-danger); }
.dt-badge-secondary { background: rgba(34,53,60,0.1); color: var(--color-secondary); }
.dt-badge-info { background: rgba(6,147,227,0.12); color: var(--color-info); }
.dt-badge-neutral { background: var(--color-border); color: var(--color-text-muted); }

/* ============================================================
   TABLES
   ============================================================ */
.dt-table-wrapper { overflow-x: auto; }

.dt-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.dt-table thead th {
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    padding: 11px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.dt-table tbody tr { border-bottom: 1px solid var(--color-border); transition: background var(--transition); }
.dt-table tbody tr:last-child { border-bottom: none; }
.dt-table tbody tr:hover { background: var(--color-bg); }
.dt-table td { padding: 12px 14px; vertical-align: middle; }
.dt-table td.muted { color: var(--color-text-muted); font-size: 12px; }

/* ============================================================
   FORMS
   ============================================================ */
.dt-form-group { margin-bottom: 16px; }

.dt-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.dt-input, .dt-select, .dt-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--border-radius);
    font-family: 'Sora', sans-serif;
    font-size: 13.5px;
    color: var(--color-text);
    background: var(--color-bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.dt-input:focus, .dt-select:focus, .dt-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.dt-textarea { resize: vertical; min-height: 90px; }

.dt-form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.dt-form-row-2 { grid-template-columns: 1fr 1fr; }
.dt-form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ============================================================
   TABS
   ============================================================ */
.dt-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    gap: 0;
    margin-bottom: 20px;
}

.dt-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: 'Sora', sans-serif;
}

.dt-tab:hover { color: var(--color-primary); }
.dt-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.dt-auth-page {
    min-height: 100vh;
    background: var(--color-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.dt-auth-page::before {
    content: '';
    position: absolute;
    top: -20%; right: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(97,189,174,0.15), transparent 60%);
    pointer-events: none;
}

.dt-auth-card {
    background: var(--color-bg-card);
    border-radius: 20px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.dt-auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
    gap: 8px;
}

.dt-auth-logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.dt-auth-brand { font-size: 22px; font-weight: 700; color: var(--color-text); text-align: center; }
.dt-auth-sub { font-size: 11px; color: var(--color-text-muted); text-align: center; text-transform: uppercase; letter-spacing: 0.08em; }

/* ============================================================
   PATIENT DETAILS
   ============================================================ */
.dt-patient-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-muted { color: var(--color-text-muted); font-size: 12px; }
.text-small { font-size: 12px; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-primary { color: var(--color-primary); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

/* ============================================================
   BLAZOR
   ============================================================ */
#blazor-error-ui {
    background: var(--color-danger);
    bottom: 0; left: 0;
    display: none;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
    font-size: 13px;
}

#blazor-error-ui .dismiss { cursor: pointer; font-weight: 700; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }

.loading-progress { position: relative; display: block; width: 8rem; height: 8rem; margin: 20vh auto 1rem; }
.loading-progress circle {
    fill: none;
    stroke: var(--color-primary);
    stroke-dasharray: 472px;
    stroke-dashoffset: calc(472px * (1 - var(--blazor-load-percentage, 0%) / 100));
    stroke-width: 0.6rem;
    stroke-linecap: round;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
    transition: stroke-dashoffset 0.05s ease-in-out;
}

.loading-progress-text { position: absolute; text-align: center; font-size: 0.8rem; top: calc(50% - 0.5rem); width: 100%; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Laden..."); }

@media (max-width: 1024px) {
    .dt-sidebar { transform: translateX(-100%); }
    .dt-sidebar.open { transform: translateX(0); }
    .dt-main { margin-left: 0; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .dt-stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .dt-stats-grid { grid-template-columns: 1fr; }
    .dt-form-row-2, .dt-form-row-3 { grid-template-columns: 1fr; }
    .dt-content { padding: 16px; }
}
