/* ==========================================================================
   Prosperous Couples Workshop - Interactive Form Styles
   Based on existing couples-workshop.css design system
   ========================================================================== */

/* Tailwind CSS via CDN - add this before this file in HTML:
   <script src="https://cdn.tailwindcss.com"></script>
*/

/* CSS Variables - Design System */
:root {
    /* Burgundy Palette */
    --burgundy-50: #FDF8F4;
    --burgundy-100: #FFFAF6;
    --burgundy-200: #FCE8E8;
    --burgundy-300: #F5C4C4;
    --burgundy-400: #E87979;
    --burgundy-500: #C41E4A;
    --burgundy-600: #9B0337;
    --burgundy-700: #7A0229;
    --burgundy-800: #5A011D;
    --burgundy-900: #3D0114;

    /* Accent Colors */
    --accent: #D4A574;
    --accent-light: #E8CDB5;
    --accent-dark: #B8895C;

    /* Neutrals */
    --cream: #FDF8F4;
    --warm-white: #FFFAF6;
    --text-primary: #2D2A26;
    --text-muted: #4A4540;
    --border-color: #E8E2DC;

    /* Typography */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --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);
    --shadow-card: 0 8px 40px rgba(155, 3, 55, 0.08);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
.font-display {
    font-family: var(--font-display);
}

.font-body {
    font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
}

/* Form Elements */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-body);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: white;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--burgundy-500);
    box-shadow: 0 0 0 3px rgba(155, 3, 55, 0.1);
}

.form-input::placeholder {
    color: #9CA3AF;
}

.form-input:disabled {
    background-color: #F3F4F6;
    cursor: not-allowed;
}

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

/* Number input without spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Custom Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234A4540'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* Radio & Checkbox */
.form-radio,
.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border-color);
    transition: all var(--transition-fast);
}

.form-radio {
    border-radius: 50%;
}

.form-checkbox {
    border-radius: var(--radius-sm);
}

.form-radio:checked,
.form-checkbox:checked {
    border-color: var(--burgundy-600);
    background-color: var(--burgundy-600);
}

/* Likert Scale (Quiz) */
.likert-scale {
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.likert-option {
    flex: 1;
    text-align: center;
}

.likert-option input {
    display: none;
}

.likert-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: white;
}

.likert-option label:hover {
    border-color: var(--burgundy-300);
    background-color: var(--burgundy-50);
}

.likert-option input:checked + label {
    border-color: var(--burgundy-600);
    background-color: var(--burgundy-600);
    color: white;
}

.likert-number {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.likert-text {
    font-size: 0.625rem;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 640px) {
    .likert-text {
        display: none;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    text-decoration: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--burgundy-600) 0%, var(--burgundy-700) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--burgundy-600);
    border: 2px solid var(--burgundy-600);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--burgundy-50);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--burgundy-50);
    color: var(--burgundy-600);
}

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

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

.btn-full {
    width: 100%;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--cream) 0%, white 100%);
}

.card-body {
    padding: 1.5rem;
}

.card-accent {
    position: relative;
}

.card-accent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--burgundy-600), var(--accent));
}

/* Personality Result Cards */
.personality-card {
    background: linear-gradient(135deg, var(--burgundy-600) 0%, var(--burgundy-700) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.personality-card.spender {
    background: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%);
}

.personality-card.saver {
    background: linear-gradient(135deg, #27AE60 0%, #1E8449 100%);
}

.personality-card.avoider {
    background: linear-gradient(135deg, #9B59B6 0%, #7D3C98 100%);
}

.personality-card.monk {
    background: linear-gradient(135deg, #F39C12 0%, #D68910 100%);
}

.personality-card.investor {
    background: linear-gradient(135deg, #3498DB 0%, #2980B9 100%);
}

/* Budget Table */
.budget-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.budget-table th {
    background: var(--burgundy-600);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
}

.budget-table th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.budget-table th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.budget-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.budget-table tr:last-child td {
    border-bottom: none;
}

.budget-table tr:nth-child(even) td {
    background: var(--cream);
}

.budget-table .total-row td {
    background: var(--burgundy-50);
    font-weight: 700;
    border-top: 2px solid var(--burgundy-600);
}

.budget-input {
    width: 80px;
    text-align: right;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.budget-input:focus {
    outline: none;
    border-color: var(--burgundy-500);
}

.budget-input.valid {
    border-color: #27AE60;
    background-color: #D5F5E3;
}

.budget-input.invalid {
    border-color: #E74C3C;
    background-color: #FADBD8;
}

/* Expense Table */
.expense-table {
    width: 100%;
}

.expense-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.expense-row:last-child {
    border-bottom: none;
}

.expense-label {
    font-weight: 500;
    flex: 1;
}

.expense-input {
    width: 120px;
    text-align: right;
}

/* Progress indicators */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring circle {
    transition: stroke-dashoffset var(--transition-slow);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.alert-info {
    background: #EBF5FB;
    border: 1px solid #3498DB;
    color: #21618C;
}

.alert-success {
    background: #D5F5E3;
    border: 1px solid #27AE60;
    color: #1E8449;
}

.alert-warning {
    background: #FCF3CF;
    border: 1px solid #F39C12;
    color: #9A7D0A;
}

.alert-error {
    background: #FADBD8;
    border: 1px solid #E74C3C;
    color: #922B21;
}

/* Dividers */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider-icon {
    color: var(--accent);
    font-size: 0.875rem;
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Loading Spinner */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--burgundy-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Auto-save indicator */
.autosave-indicator {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    color: var(--text-muted);
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-normal);
}

.autosave-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.autosave-indicator.saving {
    color: var(--burgundy-600);
}

.autosave-indicator.saved {
    color: #27AE60;
}

/* Quiz question */
.quiz-question {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.quiz-question:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.quiz-question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--burgundy-600);
    color: white;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.quiz-question-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Step Navigation */
.step-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.step-nav .btn {
    min-width: 120px;
}

/* Responsive */
@media (max-width: 640px) {
    .step-nav {
        flex-direction: column-reverse;
    }

    .step-nav .btn {
        width: 100%;
    }
}

/* Utilities */
.text-burgundy {
    color: var(--burgundy-600);
}

.bg-burgundy {
    background-color: var(--burgundy-600);
}

.border-burgundy {
    border-color: var(--burgundy-600);
}

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

.bg-cream {
    background-color: var(--cream);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--burgundy-500);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
