/* MixedSignal Pro Portal - CSS */

@font-face {
    font-family: 'Roobert';
    src: url("../fonts/Roobert-Regular.b443ecd1475d.otf") format('opentype');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Roobert';
    src: url("../fonts/Roobert-Medium.ff8b49bda536.otf") format('opentype');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Roobert';
    src: url("../fonts/Roobert-SemiBold.2ab6876a6b17.otf") format('opentype');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Roobert';
    src: url("../fonts/Roobert-Bold.09726c717d3c.otf") format('opentype');
    font-weight: 700; font-style: normal; font-display: swap;
}

:root {
    --color-primary: #f05924;
    --color-primary-dark: #d04a1a;
    --color-background: #2A1E2A;
    --color-background-light: #3a2e3a;
    --color-surface: #1a141a;
    --color-text: #ffffff;
    --color-text-muted: #a09aa0;
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    
    --font-family: 'Roobert', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    
    --sidebar-width: 260px;
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--color-background);
    color: var(--color-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    border-right: 1px solid var(--color-background-light);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 40px;
}

.logo {
    height: 32px;
    width: auto;
}

.logo-text {
    font-size: 20px;
    font-weight: 300;
    color: var(--color-primary);
}

.logo-badge {
    background: var(--color-primary);
    color: var(--color-text);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    margin-bottom: 4px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--color-background-light);
    color: var(--color-text);
}

.nav-link.active {
    background: var(--color-primary);
    color: var(--color-text);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    border-top: 1px solid var(--color-background-light);
    padding-top: 20px;
}

.user-info {
    margin-bottom: 12px;
}

.user-name {
    display: block;
    font-weight: 500;
}

.user-role {
    font-size: 12px;
    color: var(--color-text-muted);
}

.logout-link {
    color: var(--color-text-muted);
    font-size: 14px;
    text-decoration: none;
}

.logout-link:hover {
    color: var(--color-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    max-width: 1400px;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 300;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--color-text-muted);
}

.back-link {
    display: inline-block;
    color: var(--color-text-muted);
    text-decoration: none;
    margin-bottom: 12px;
    font-size: 14px;
}

.back-link:hover {
    color: var(--color-primary);
}

/* Messages/Alerts */
.messages {
    margin-bottom: 24px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Sections */
.section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 400;
}

/* Cards */
.card {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

.card h2 {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 20px;
    color: var(--color-primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h2 {
    margin-bottom: 0;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-background-light);
}

.data-table th {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: var(--color-background-light);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--color-text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--color-background);
    border: 1px solid var(--color-background-light);
    border-radius: var(--border-radius-sm);
    color: var(--color-text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-background-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-text);
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-background-light);
    color: var(--color-text);
}

.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--color-error);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

/* Grid Layout */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Info List */
.info-list {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 16px;
}

.info-list dt {
    color: var(--color-text-muted);
    font-size: 14px;
}

.info-list dd {
    font-size: 14px;
}

/* Audiogramm Table */
.audiogramm-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.audiogramm-table th,
.audiogramm-table td {
    padding: 8px;
    border-bottom: 1px solid var(--color-background-light);
}

.audiogramm-table th {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
}

.freq-label {
    font-weight: 500;
    text-align: right;
    padding-right: 16px;
}

.audiogramm-input {
    width: 80px;
    text-align: center;
}

/* Zusatz Frequenzen */
.zusatz-frequenzen {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-background-light);
}

.zusatz-frequenzen h4 {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 12px;
    color: var(--color-text-muted);
}

.zusatz-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.freq-input {
    width: 100px;
}

/* Profil Display */
.profil-info {
    font-size: 14px;
}

.profil-version {
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

/* Tabs */
.stufen-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-background-light);
    padding-bottom: 12px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--color-background-light);
    border-radius: var(--border-radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.tab-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-text);
}

.tab-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text);
}

/* Koeffizienten Display */
.koeff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.koeff-column h5 {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.koeff-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
}

.koeff-freq {
    width: 50px;
    color: var(--color-text-muted);
    text-align: right;
}

.bar-container {
    flex: 1;
    height: 12px;
    background: var(--color-background);
    border-radius: 6px;
    overflow: hidden;
}

.bar {
    height: 100%;
    border-radius: 6px;
    min-width: 2px;
}

.bar.positive {
    background: var(--color-primary);
}

.bar.negative {
    background: var(--color-error);
}

.koeff-value {
    width: 45px;
    text-align: right;
}

.stufe-info {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-bottom: 16px;
}

.profil-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-background-light);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.empty-state p {
    margin-bottom: 16px;
}

/* Links */
.link-primary {
    color: var(--color-primary);
    text-decoration: none;
}

.link-primary:hover {
    text-decoration: underline;
}

.text-muted {
    color: var(--color-text-muted);
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-background);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.login-title {
    font-size: 32px;
    color: var(--color-primary);
}

.title-normal {
    font-weight: 300;
}

.title-bold {
    font-weight: 700;
}

.login-badge {
    background: var(--color-primary);
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

.login-form {
    margin-bottom: 24px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-footer {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   FEINJUSTIERUNG
   ======================================== */

.feinjustierung-section {
    background: var(--color-background);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.feinjustierung-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.feinjustierung-section .section-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
}

.feinjustierung-section .help-text {
    font-size: 12px;
    color: var(--color-text-muted);
}

.feinjustierung-section .info-text {
    font-size: 13px;
    color: var(--color-text);
    background: rgba(240, 89, 36, 0.1);
    border-left: 3px solid var(--color-primary);
    padding: 12px 16px;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin-bottom: 20px;
}

.feinjustierung-section .info-text .text-muted {
    color: var(--color-text-muted);
    font-size: 12px;
}

.stufe-select {
    margin-bottom: 20px;
}

.stufe-select label {
    display: block;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.stufe-select select {
    width: 100%;
    max-width: 300px;
    padding: 10px 12px;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius-sm);
    color: var(--color-text);
    font-size: 14px;
}

.anpassung-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .anpassung-grid {
        grid-template-columns: 1fr;
    }
}

.anpassung-column h5 {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.anpassung-row {
    display: grid;
    grid-template-columns: 70px 1fr 45px 25px;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.anpassung-row .freq-label {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: right;
}

.anpassung-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--color-surface);
    border-radius: 3px;
    outline: none;
}

.anpassung-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform 0.1s;
}

.anpassung-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.anpassung-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
}

.slider-value {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    font-family: monospace;
    min-width: 40px;
}

.slider-value.positive {
    color: var(--color-success);
}

.slider-value.negative {
    color: var(--color-error);
}

.db-label {
    font-size: 11px;
    color: var(--color-text-muted);
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.quick-actions .btn {
    font-size: 12px;
    padding: 6px 12px;
}

.section-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 24px 0;
}

/* Anpassungs-Feedback Animation */
@keyframes pulse-success {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.feinjustierung-section.success {
    animation: pulse-success 0.5s ease-out;
}
