/* CSS Variables - Panic-Friendly Color Scheme */
:root {
    --bg-primary: #0F172A;
    --surface-dark: #111827;
    --card-bg: #1F2937;
    --text-primary: #FFFFFF;
    --text-secondary: #E5E7EB;
    --alert-red: #EF4444;
    --warning-yellow: #F59E0B;
    --success-green: #22C55E;
    --accent-blue: #38BDF8;
    --muted: #9CA3AF;
    --border-color: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Loading Screen Styles */
.initial-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    text-align: center;
}

.initial-loading h2 {
    margin-bottom: 1rem;
    color: var(--accent-blue);
}

.initial-loading p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Header */
.header {
    background: var(--surface-dark);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.brand {
    display: block;
    color: var(--accent-blue);
}

.subtitle {
    display: block;
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 0.2rem;
}

.help-button {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    flex-shrink: 0;
}

.help-button:hover {
    background: #0ea5e9;
    transform: translateY(-1px);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1004;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header h3 {
    color: var(--accent-blue);
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--surface-dark);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

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

.help-section h4 {
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.help-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-section ol, .help-section ul {
    color: var(--text-secondary);
    padding-left: 1.5rem;
}

.help-section li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.modal-button {
    background: var(--success-green);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.modal-button:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Main Content */
.main {
    min-height: calc(100vh - 120px);
}

/* Progress Indicator */
.progress-indicator {
    background: var(--surface-dark);
    padding: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.progress-step.active {
    color: var(--accent-blue);
    font-weight: 600;
}

.progress-step.completed {
    color: var(--success-green);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.progress-step.active .step-number {
    background: var(--accent-blue);
    color: white;
}

.progress-step.completed .step-number {
    background: var(--success-green);
    color: white;
}

.step-label {
    display: none;
}

@media (min-width: 768px) {
    .step-label {
        display: inline;
    }
    
    .progress-indicator {
        gap: 3rem;
    }
}

/* Hero Section */
.hero {
    padding: 2rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1e293b 100%);
}

.hero-content {
    max-width: 600px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
}

.panic-line {
    background: linear-gradient(45deg, var(--alert-red), #dc2626);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin: 2rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    animation: pulse 2s infinite;
    box-shadow: var(--shadow-lg);
}

.panic-icon {
    font-size: 1.3rem;
}

.cta-button {
    background: linear-gradient(45deg, var(--success-green), #16a34a);
    color: white;
    border: none;
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 56px;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(34, 197, 94, 0.3);
}

/* Section Titles */
.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

/* Problem Selection Tiles */
.problem-selection {
    padding: 2rem 0;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.tile {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.tile:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.tile.selected {
    border-color: var(--success-green);
    background: rgba(34, 197, 94, 0.1);
}

.tile-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.tile-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tile-description {
    font-size: 0.9rem;
    color: var(--muted);
}

/* Filters Section */
.filters-section {
    padding: 2rem 0;
    background: var(--surface-dark);
}

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

.filter-group {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.filter-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.filter-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.filter-option {
    background: var(--surface-dark);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-size: 0.9rem;
}

.filter-option:hover {
    border-color: var(--accent-blue);
}

.filter-option.selected {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

/* Results Section */
.results-section {
    padding: 2rem 0;
}

.sticky-actions {
    position: sticky;
    top: 80px;
    z-index: 50;
    margin-bottom: 2rem;
    background: linear-gradient(45deg, var(--alert-red), #dc2626);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.5s ease-out;
}

.results-content {
    max-width: 800px;
    margin: 0 auto;
}

.result-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--accent-blue);
    box-shadow: var(--shadow);
}

.result-section.urgent {
    border-left-color: var(--alert-red);
    background: rgba(239, 68, 68, 0.1);
}

.result-section.legal {
    border-left-color: var(--warning-yellow);
}

.result-section.success {
    border-left-color: var(--success-green);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-icon {
    font-size: 1.3rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.action-item {
    background: var(--surface-dark);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.action-priority {
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.action-content {
    flex: 1;
}

.action-text {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.action-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.copy-button {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.copy-button:hover {
    background: #0ea5e9;
}

.copy-button.copied {
    background: var(--success-green);
}

.law-item {
    background: var(--surface-dark);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
}

.law-name {
    font-weight: 600;
    color: var(--warning-yellow);
    margin-bottom: 0.3rem;
}

.law-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.law-plain {
    color: var(--text-primary);
    font-style: italic;
}

.complaint-item {
    background: var(--surface-dark);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.priority-badge {
    background: var(--warning-yellow);
    color: black;
    border-radius: var(--radius);
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.complaint-content {
    flex: 1;
}

.complaint-place {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.complaint-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.complaint-timeframe {
    color: var(--success-green);
    font-size: 0.8rem;
    font-weight: 500;
}

.dont-do-list {
    list-style: none;
    padding: 0;
}

.dont-do-item {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--alert-red);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

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

.proof-item {
    background: var(--surface-dark);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.proof-icon {
    color: var(--accent-blue);
    font-size: 1.2rem;
}

.reality-check-item {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-yellow);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    font-style: italic;
}

/* Navigation Buttons */
.back-button, .next-button, .restart-button {
    background: var(--surface-dark);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 500;
    margin: 0.5rem;
    min-height: 48px;
}

.back-button:hover, .next-button:hover, .restart-button:hover {
    border-color: var(--accent-blue);
    background: var(--card-bg);
}

.next-button {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.next-button:hover {
    background: #0ea5e9;
    border-color: #0ea5e9;
}

.restart-button {
    background: var(--warning-yellow);
    border-color: var(--warning-yellow);
    color: black;
}

.restart-button:hover {
    background: #d97706;
    border-color: #d97706;
}

/* Footer */
.footer {
    background: var(--surface-dark);
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.disclaimer {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-yellow);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.disclaimer h4 {
    color: var(--warning-yellow);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.disclaimer p {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.small-text {
    font-size: 0.8rem;
    color: var(--muted);
}

.footer-info {
    text-align: center;
    color: var(--muted);
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading p {
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideInRight {
    from { 
        opacity: 0; 
        transform: translateX(100%); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes slideOutRight {
    from { 
        opacity: 1; 
        transform: translateX(0); 
    }
    to { 
        opacity: 0; 
        transform: translateX(100%); 
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notification Styles */
.toast-notification {
    animation: slideInRight 0.3s ease-out;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.8rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .tiles-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .filter-options {
        grid-template-columns: 1fr;
    }
    
    .sticky-actions {
        position: static;
        margin-bottom: 1rem;
    }
    
    .cta-button {
        width: 100%;
        font-size: 1rem;
    }
    
    .back-button, .next-button, .restart-button {
        width: 100%;
        margin: 0.5rem 0;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 1.5rem 0;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .tile {
        padding: 1rem;
        min-height: 100px;
    }
    
    .tile-icon {
        font-size: 2rem;
    }
    
    .filter-group {
        padding: 1rem;
    }
    
    .result-section {
        padding: 1rem;
    }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-primary: #000000;
        --surface-dark: #111111;
        --card-bg: #222222;
        --text-primary: #ffffff;
        --border-color: #555555;
    }
}

/* Focus styles for accessibility */
button:focus, .tile:focus, .filter-option:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header, .footer, .loading {
        display: none;
    }
    
    .sticky-actions {
        position: static;
        break-inside: avoid;
    }
    
    .result-section {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}
