/**
 * App Light Mode - Shared CSS
 *
 * Reusable light-mode styles for app pages.
 * Based on Company Research design patterns.
 * See appdesign.md for full documentation.
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    /* Primary */
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-primary-light: #60a5fa;

    /* CTA */
    --color-cta: #ed8936;
    --color-cta-hover: #dd6b20;

    /* Backgrounds */
    --color-bg-page: #f7f9fc;
    --color-bg-card: #ffffff;
    --color-bg-input: #f8f9fa;
    --color-bg-chip: #f7fafc;

    /* Text */
    --color-text-primary: #1a202c;
    --color-text-secondary: #4a5568;
    --color-text-muted: #718096;
    --color-text-placeholder: #a0aec0;

    /* Borders */
    --color-border: #e2e8f0;
    --color-border-focus: #3b82f6;
    --color-border-hover: #a5b4fc;

    /* Status */
    --color-success: #48bb78;
    --color-success-bg: #f0fff4;
    --color-error: #e53e3e;
    --color-error-bg: #fff5f5;
    --color-warning: #ecc94b;
    --color-warning-bg: #fffff0;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 20px;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(59, 130, 246, 0.25);
    --shadow-cta: 0 4px 12px rgba(237, 137, 54, 0.3);
    --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.app-wrapper {
    background: var(--color-bg-page);
    min-height: 100vh;
    margin: -2rem;
    padding: 2rem;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
}

.app-container--narrow {
    max-width: 900px;
}

/* ==========================================================================
   Input Section (Form Card)
   ========================================================================== */

.input-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-2xl);
}

.form-label {
    display: block;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
    font-weight: 500;
    font-size: 1rem;
}

.helper-text {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: var(--space-lg);
}

.input-row {
    display: flex;
    gap: var(--space-md);
    align-items: stretch;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--color-bg-input);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    background: var(--color-bg-card);
    box-shadow: var(--shadow-focus);
}

.text-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    font-size: 1.1rem;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    width: 100%;
}

.text-input:focus {
    outline: none;
}

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

/* ==========================================================================
   Buttons
   ========================================================================== */

/* Go Button (Primary CTA - Orange) */
.go-btn {
    padding: 0.875rem 2rem;
    background: var(--color-cta);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.go-btn:hover:not(:disabled) {
    background: var(--color-cta-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-cta);
}

.go-btn:disabled {
    background: var(--color-text-placeholder);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Primary Button (Blue) */
.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.55rem 1.1rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

/* Secondary Button (Outline) */
.btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: 0.55rem 1.1rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* ==========================================================================
   Chips / Tags
   ========================================================================== */

.example-chips {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

.example-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.chip {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--color-bg-chip);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.chip:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.chip:active {
    transform: translateY(0);
}

.chip.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.results-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-xl);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

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

/* ==========================================================================
   Feature Cards Grid
   ========================================================================== */

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-2xl);
}

.feature-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    transition: all 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-lg);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
}

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

.feature-description {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.loading-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-2xl);
    color: var(--color-text-muted);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Error State
   ========================================================================== */

.error-section {
    background: var(--color-error-bg);
    border: 1px solid #fc8181;
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-lg);
}

.error-message {
    color: var(--color-error);
    margin: 0;
    font-size: 0.95rem;
}

/* ==========================================================================
   Success State
   ========================================================================== */

.success-section {
    background: var(--color-success-bg);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-lg);
}

.success-message {
    color: #276749;
    margin: 0;
    font-size: 0.95rem;
}

/* ==========================================================================
   Layout Helpers
   ========================================================================== */

.results-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--space-2xl);
    align-items: start;
}

.results-main {
    min-width: 0;
}

.results-sidebar {
    position: sticky;
    top: var(--space-2xl);
}

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

@media (max-width: 768px) {
    .app-wrapper {
        padding: var(--space-lg);
        margin: -1rem;
    }

    .input-section {
        padding: var(--space-xl);
    }

    .input-row {
        flex-direction: column;
    }

    .go-btn {
        width: 100%;
    }

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

    .results-with-sidebar {
        grid-template-columns: 1fr;
    }

    .results-sidebar {
        order: -1;
        position: static;
    }
}
