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

:root {
    --bg-dark: #0a0f1a;
    --bg-card: #111827;
    --bg-input: #1a2235;
    --accent: #00d4aa;
    --accent-hover: #00b894;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: #1e293b;
    --error: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
}

/* === Wizard Container === */
.wizard-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.wizard-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    font-family: 'Anybody', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 4px;
}

/* === Progress Bar === */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 16px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 16.66%;
    transition: width 0.4s ease;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    padding: 0 10px;
}

.step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    transition: all 0.3s ease;
}

.step-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.step-dot.completed {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    opacity: 0.6;
}

/* === Steps === */
.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step h2 {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.step-desc {
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* === Form Elements === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

.required {
    color: var(--accent);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

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

textarea {
    resize: vertical;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

select option {
    background: var(--bg-card);
    color: var(--text);
}

.field-error {
    display: block;
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 4px;
    min-height: 1.2em;
}

.error-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* === Checkboxes === */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.checkbox-label:hover {
    border-color: var(--accent);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* === File Upload === */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    position: relative;
    margin-bottom: 16px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.upload-hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 8px;
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.file-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-next {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-next:hover {
    background: var(--accent-hover);
}

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

.btn-back:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-submit {
    background: var(--accent);
    color: var(--bg-dark);
    padding: 14px 36px;
    font-size: 1rem;
}

.btn-submit:hover {
    background: var(--accent-hover);
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.8rem;
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-small:hover {
    background: var(--accent-hover);
}

.step-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    gap: 12px;
}

/* === Review === */
.review-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.review-section h3 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 12px;
}

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

.review-item {
    font-size: 0.9rem;
}

.review-full {
    grid-column: 1 / -1;
    margin-top: 8px;
}

.review-label {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.review-list {
    list-style: none;
    padding: 0;
}

.review-list li {
    padding: 4px 0;
    font-size: 0.9rem;
}

.review-list li::before {
    content: "\2713 ";
    color: var(--accent);
    margin-right: 6px;
}

/* === Confirmation === */
.confirmation-card {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 32px;
}

.confirmation-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-dark);
    font-size: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-weight: 700;
}

.confirmation-card h2 {
    margin-bottom: 8px;
}

.reference-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reference-label {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reference-number {
    font-family: 'Anybody', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
}

.confirmation-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* === Admin === */
.admin-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

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

.admin-badge {
    font-size: 0.7rem;
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 20px;
    vertical-align: middle;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.admin-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.admin-login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.admin-login-card .logo {
    margin-bottom: 8px;
}

.admin-login-card h2 {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 28px;
}

.admin-login-card .form-group {
    text-align: left;
}

/* === Stats === */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

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

.stat-number {
    display: block;
    font-family: 'Anybody', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === Cases Table === */
.cases-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

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

.cases-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}

.cases-table td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.cases-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.cases-table tbody tr:hover {
    background: var(--bg-input);
}

.ref-cell {
    font-family: 'Anybody', sans-serif;
    font-weight: 600;
    color: var(--accent);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-new { background: rgba(0, 212, 170, 0.15); color: var(--accent); }
.status-in_progress { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-resolved { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-closed { background: rgba(100, 116, 139, 0.15); color: var(--text-dim); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* === Case Detail === */
.case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.case-header h2 {
    font-family: 'Anybody', sans-serif;
    color: var(--accent);
    margin-right: 12px;
    display: inline;
}

.status-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-form select {
    width: auto;
    padding: 8px 36px 8px 12px;
    font-size: 0.85rem;
}

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

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.detail-card h3 {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-row {
    font-size: 0.9rem;
    padding: 4px 0;
}

.detail-label {
    color: var(--text-dim);
}

.detail-description {
    margin-top: 8px;
    white-space: pre-wrap;
}

.steps-list {
    list-style: none;
    padding: 0;
}

.steps-list li {
    padding: 6px 0;
    font-size: 0.9rem;
}

.steps-list li::before {
    content: "\2713 ";
    color: var(--accent);
    margin-right: 6px;
}

.documents-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-link {
    display: inline-block;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    transition: border-color 0.2s ease;
}

.doc-link:hover {
    border-color: var(--accent);
}

/* === Upload More === */
.upload-more-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.upload-more-input {
    display: none;
}

.upload-more-label {
    cursor: pointer;
}

.btn-upload-more {
    font-size: 0.85rem;
    padding: 8px 16px;
}

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

/* === Analysis Section === */
.analysis-section {
    margin-top: 24px;
    margin-bottom: 32px;
}

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

.analysis-header h3 {
    font-size: 1.2rem;
}

.analysis-loading {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.analysis-loading p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.strength-badge-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.strength-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.strength-strong {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.strength-moderate {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.strength-needs_more_evidence {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.strength-explanation {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.analysis-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.analysis-card h4 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.analysis-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

.analysis-warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.analysis-warning h4 {
    color: var(--warning);
}

.key-facts-list {
    list-style: none;
    padding: 0;
}

.key-facts-list li {
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}

.key-facts-list li:last-child {
    border-bottom: none;
}

.key-facts-list li::before {
    content: "\2022 ";
    color: var(--accent);
    margin-right: 8px;
    font-weight: 700;
}

/* === Letter Section === */
.letter-section {
    margin-top: 32px;
}

.letter-section h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.generate-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.generate-form select {
    width: auto;
    min-width: 240px;
}

.letters-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.letter-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.letter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.letter-header h4 {
    color: var(--accent);
    font-size: 1rem;
}

.letter-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.letter-content {
    padding: 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-muted);
    max-height: 400px;
    overflow-y: auto;
}

/* === Responsive === */
@media (max-width: 768px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .generate-form {
        flex-direction: column;
    }

    .generate-form select {
        min-width: 100%;
    }

    .case-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .admin-stats {
        grid-template-columns: 1fr 1fr;
    }

    .wizard-container {
        padding: 24px 16px 40px;
    }

    .logo {
        font-size: 2rem;
    }
}
