/* =====================================================
   Support-Portal - Shadcn-inspiriertes Design
   ===================================================== */

/* CSS Variables (Shadcn Color Palette) */
:root {
    --background: #ffffff;
    --foreground: #0a0a0a;
    --card: #ffffff;
    --card-foreground: #0a0a0a;
    --popover: #ffffff;
    --popover-foreground: #0a0a0a;
    --primary: #171717;
    --primary-foreground: #fafafa;
    --secondary: #f5f5f5;
    --secondary-foreground: #171717;
    --muted: #f5f5f5;
    --muted-foreground: #737373;
    --accent: #f5f5f5;
    --accent-foreground: #171717;
    --destructive: #ef4444;
    --destructive-foreground: #fafafa;
    --border: #e5e5e5;
    --input: #e5e5e5;
    --ring: #171717;
    --radius: 0.5rem;

    /* Status Colors */
    --status-neu: #ef4444;
    --status-in-bearbeitung: #f59e0b;
    --status-erledigt: #22c55e;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

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

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Login Layout */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: linear-gradient(135deg, #f5f5f5 0%, #e5e5e5 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-form .form-group {
    margin-bottom: 0;
}

.login-form .form-group label {
    margin-bottom: 0.5rem;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.header-content h1 {
    margin-bottom: 0.25rem;
}

/* Main Content */
.main-content {
    margin-bottom: 2rem;
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   Card Component
   ===================================================== */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2,
.card-header h3,
.card-header h4 {
    margin: 0;
}

.card-header p {
    margin-top: 0.25rem;
}

.card-content {
    padding: 1.5rem;
}

.card-content.p-0 {
    padding: 0;
}

/* =====================================================
   Form Components
   ===================================================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.form-label.required::after {
    content: " *";
    color: var(--destructive);
}

.form-label-small {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--muted-foreground);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--foreground);
    background-color: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(23, 23, 23, 0.1);
}

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

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Radio Cards */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-card {
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.radio-card input:checked + .radio-card-content {
    border-color: var(--primary);
    background-color: var(--secondary);
}

.radio-card:hover .radio-card-content {
    background-color: var(--muted);
}

.radio-indicator {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.radio-card input:checked + .radio-card-content .radio-indicator {
    border-color: var(--primary);
}

.radio-card input:checked + .radio-card-content .radio-indicator::after {
    content: "";
    width: 0.625rem;
    height: 0.625rem;
    background-color: var(--primary);
    border-radius: 50%;
}

.radio-label {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Value Comparison */
.value-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
}

.value-comparison .form-group {
    margin-bottom: 0;
}

.comparison-arrow {
    color: var(--muted-foreground);
    font-size: 1.5rem;
    font-weight: 300;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.value-comparison-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.value-box {
    flex: 1;
    padding: 1rem;
    background: var(--secondary);
    border-radius: var(--radius);
    text-align: center;
}

.value-box-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.value-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-bottom: 0.25rem;
}

.value-amount {
    font-size: 1.125rem;
    font-weight: 600;
}

.comparison-arrow-display {
    color: var(--muted-foreground);
    font-size: 1.5rem;
}

/* Jahr Entry */
.jahr-entry {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--muted);
    border-radius: var(--radius);
}

.jahr-row {
    display: grid;
    grid-template-columns: 100px 140px 1fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

@media (max-width: 768px) {
    .jahr-row {
        grid-template-columns: 1fr 1fr;
    }

    .jahr-row button {
        grid-column: span 2;
    }
}

/* File Upload */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: all 0.15s ease;
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--primary);
    background-color: var(--muted);
}

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

.file-upload-content {
    pointer-events: none;
}

.upload-icon {
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

/* File List */
.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--muted);
    border-radius: var(--radius);
}

.file-icon {
    color: var(--destructive);
    flex-shrink: 0;
}

.file-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.file-remove-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--muted-foreground);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.file-remove-btn:hover {
    background-color: #fef2f2;
    color: var(--destructive);
}

/* File Download List */
.file-download-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-download-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--muted);
    border-radius: var(--radius);
    transition: all 0.15s ease;
}

.file-download-item:hover {
    background: var(--secondary);
}

.file-download-item .file-info {
    flex: 1;
    min-width: 0;
}

.file-download-item .file-name {
    display: block;
}

.download-icon {
    color: var(--muted-foreground);
}

/* Form Actions */
.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* =====================================================
   Button Component
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

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

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

.btn-primary:hover {
    background-color: #262626;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--foreground);
}

.btn-outline:hover {
    background-color: var(--muted);
}

.btn-danger {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* =====================================================
   Badge Component
   ===================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    color: white;
}

.badge-lg {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

/* =====================================================
   Alert Component
   ===================================================== */

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

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

/* =====================================================
   Table Component
   ===================================================== */

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

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    background: var(--muted);
}

.table tbody tr:hover {
    background-color: var(--muted);
}

.table-sm th,
.table-sm td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.ticket-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    color: var(--primary);
}

.ticket-id:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--muted-foreground);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
}

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

.sidebar-header h2 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--muted);
    color: var(--foreground);
}

.nav-item.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    background: var(--muted);
    min-height: 100vh;
}

.admin-header {
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 1.5rem;
}

.header-back {
    margin-bottom: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.stat-card-clickable {
    cursor: pointer;
    transition: all 0.15s ease;
}

.stat-card-clickable:hover {
    border-color: var(--primary);
}

.stat-card-clickable.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-neu { color: var(--status-neu); }
.stat-in-bearbeitung { color: var(--status-in-bearbeitung); }
.stat-erledigt { color: var(--status-erledigt); }

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Ticket Detail Grid */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

.ticket-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-item {
    padding: 0.75rem;
    background: var(--muted);
    border-radius: var(--radius);
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-weight: 500;
}

.ticket-description {
    padding: 1rem;
    background: var(--muted);
    border-radius: var(--radius);
    white-space: pre-wrap;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* Utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* =====================================================
   Excel Upload (Smaller Version)
   ===================================================== */

.file-upload-area-small {
    position: relative;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    text-align: center;
    transition: all 0.15s ease;
    cursor: pointer;
    background: var(--muted);
}

.file-upload-area-small:hover {
    border-color: var(--primary);
    background-color: var(--secondary);
}

.file-upload-area-small .file-upload-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.file-upload-area-small .upload-icon {
    margin-bottom: 0;
    width: 24px;
    height: 24px;
}

.file-upload-area-small p {
    margin: 0;
    font-size: 0.8125rem;
}

/* =====================================================
   Multi-Step Form / Review Step
   ===================================================== */

.form-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.step-indicator {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    background: var(--muted);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    transition: all 0.15s ease;
}

.step-indicator.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

.step-indicator.completed {
    background: var(--status-erledigt);
    color: white;
}

/* Review/Summary Section */
.review-section {
    background: var(--muted);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.review-section h4 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.review-item {
    padding: 0.75rem;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.review-item-full {
    grid-column: span 2;
}

.review-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.review-value {
    font-weight: 500;
    font-size: 0.9375rem;
}

/* Priority Selection */
.priority-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.priority-card {
    cursor: pointer;
}

.priority-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.priority-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s ease;
    text-align: center;
}

.priority-card:hover .priority-card-content {
    background-color: var(--muted);
}

.priority-card input:checked + .priority-card-content {
    border-width: 2px;
}

.priority-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.375rem;
}

.priority-label {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Priority Colors */
.priority-1 .priority-card-content {
    border-color: #ef4444;
}
.priority-1 input:checked + .priority-card-content {
    background: #fef2f2;
    border-color: #ef4444;
}
.priority-1 .priority-number { color: #ef4444; }

.priority-2 .priority-card-content {
    border-color: #f97316;
}
.priority-2 input:checked + .priority-card-content {
    background: #fff7ed;
    border-color: #f97316;
}
.priority-2 .priority-number { color: #f97316; }

.priority-3 .priority-card-content {
    border-color: #eab308;
}
.priority-3 input:checked + .priority-card-content {
    background: #fefce8;
    border-color: #eab308;
}
.priority-3 .priority-number { color: #eab308; }

.priority-4 .priority-card-content {
    border-color: #22c55e;
}
.priority-4 input:checked + .priority-card-content {
    background: #f0fdf4;
    border-color: #22c55e;
}
.priority-4 .priority-number { color: #22c55e; }

/* Priority Badge */
.priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
}

.priority-badge-1 { background: #ef4444; }
.priority-badge-2 { background: #f97316; }
.priority-badge-3 { background: #eab308; }
.priority-badge-4 { background: #22c55e; }

/* File Type Icons */
.file-icon-pdf { color: #ef4444; }
.file-icon-excel { color: #22c55e; }

/* Button Group for Steps */
.form-step-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.form-step-buttons .btn {
    flex: 1;
}

/* Hidden class for step visibility */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
}

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

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

    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .admin-main {
        margin-left: 0;
        padding: 1rem;
    }

    .value-comparison {
        grid-template-columns: 1fr;
    }

    .comparison-arrow {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 0.8125rem;
    }

    .table th,
    .table td {
        padding: 0.625rem 0.5rem;
    }

    .priority-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .review-grid {
        grid-template-columns: 1fr;
    }

    .review-item-full {
        grid-column: span 1;
    }

    .form-step-buttons {
        flex-direction: column;
    }
}
