/* ===================================================
   Keasy Kontaktformular - CSS 
   Farbschema angepasst an Versicherungsmanager
   =================================================== */

:root {
    /* Light Mode - Versicherungsmanager Style */
    --bg-primary: #ffffff;
    --bg-secondary: #f0f2f5;
    --bg-tertiary: #e4e6eb;
    --text-primary: #1c1e21;
    --text-secondary: #65676b;
    --text-muted: #8a8d91;
    --border-color: #dadde1;
    --border-focus: #4686af;
    --accent: #4686af;
    --accent-hover: #3a7299;
    --accent-light: #e8f1f6;
    --success: #31a24c;
    --success-bg: #e6f4ea;
    --error: #e41e3f;
    --error-bg: #ffebe9;
    --warning: #f5a623;
    --warning-bg: #fff8e7;
    --shadow: rgba(0, 0, 0, 0.08);
    --card-bg: #ffffff;
    --link-color: #4686af;
    --table-header-bg: #4686af;
    --table-header-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode - Versicherungsmanager Style */
        --bg-primary: #1c2128;
        --bg-secondary: #0d1117;
        --bg-tertiary: #21262d;
        --text-primary: #e6edf3;
        --text-secondary: #8b949e;
        --text-muted: #6e7681;
        --border-color: #30363d;
        --border-focus: #58a6d4;
        --accent: #58a6d4;
        --accent-hover: #7bbde3;
        --accent-light: #1a2f3d;
        --success: #3fb950;
        --success-bg: #1a3d2a;
        --error: #f85149;
        --error-bg: #3d1a1a;
        --warning: #d29922;
        --warning-bg: #3d2e00;
        --shadow: rgba(0, 0, 0, 0.4);
        --card-bg: #161b22;
        --link-color: #58a6d4;
        --table-header-bg: #21262d;
        --table-header-text: #e6edf3;
    }
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

/* Container */
.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container-wide {
    max-width: 1200px;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin: 0 0 1rem;
}

a {
    color: var(--link-color, var(--accent));
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

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

.form-control.is-invalid {
    border-color: var(--error);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

/* Datepicker */
input[type="date"].form-control {
    appearance: none;
}

/* File Input */
.file-input-wrapper {
    position: relative;
}

.file-input {
    display: block;
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.file-input:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.file-input input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-text {
    color: var(--text-secondary);
}

.file-input-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-list {
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

.file-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.file-remove {
    color: var(--error);
    cursor: pointer;
    font-weight: bold;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-primary {
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--border-color);
}

.btn-danger {
    color: #fff;
    background-color: var(--error);
    border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
    background-color: #bb2d3b;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.alert-danger {
    color: var(--error);
    background-color: var(--error-bg);
    border: 1px solid var(--error);
}

.alert-success {
    color: var(--success);
    background-color: var(--success-bg);
    border: 1px solid var(--success);
}

.alert-warning {
    color: #856404;
    background-color: var(--warning-bg);
    border: 1px solid var(--warning);
}

.alert ul {
    margin: 0;
    padding-left: 1.25rem;
}

.alert ul li {
    margin-bottom: 0.25rem;
}

.alert ul li:last-child {
    margin-bottom: 0;
}

/* Context Display */
.context-display {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 0 8px 8px 0;
    white-space: pre-wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Success Icon */
.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: var(--success-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    fill: var(--success);
}

/* Info Icon */
.info-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
}

.info-icon svg {
    width: 40px;
    height: 40px;
    stroke: currentColor;
}

/* Text utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-small { font-size: 0.875rem; }

/* Spacing */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 576px) {
    .container {
        padding: 1rem;
    }
    
    .card {
        padding: 1.25rem;
        border-radius: 8px;
    }
    
    .card-title {
        font-size: 1.25rem;
    }
}

/* Logo / Header */
.page-header {
    text-align: center;
    padding: 2rem 0 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    margin: 0;
}

/* Debug Panel */
.debug-panel {
    margin-top: 2rem;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    overflow: hidden;
}

.debug-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
    transition: background 0.2s;
}

.debug-header:hover {
    background: var(--bg-tertiary);
}

.debug-icon {
    font-size: 1.1rem;
}

.debug-badge {
    margin-left: auto;
    background: #e74c3c;
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.debug-panel[open] .debug-header {
    border-bottom: 1px solid var(--border-color);
}

.debug-content {
    padding: 1rem;
}

.debug-section {
    margin-bottom: 1.5rem;
}

.debug-section:last-child {
    margin-bottom: 0;
}

.debug-section h4 {
    font-size: 0.85rem;
    color: var(--accent-color);
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.debug-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.debug-table th,
.debug-table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.debug-table th {
    width: 35%;
    color: var(--text-secondary);
    font-weight: 500;
    background: var(--bg-tertiary);
}

.debug-table td {
    word-break: break-all;
}

.debug-table code {
    background: var(--bg-tertiary);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--accent-color);
}

.debug-table pre {
    margin: 0;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.7rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.debug-json {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.7rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
    max-height: 300px;
    overflow-y: auto;
}

/* Dark mode debug enhancements */
@media (prefers-color-scheme: dark) {
    .debug-panel {
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .debug-table code {
        background: rgba(70, 134, 175, 0.15);
    }
}
