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

html {
    background-color: #1e1b4b;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #581c87 0%, #1e1b4b 30%, #0a0a0f 70%, #000000 100%);
    z-index: -1;
}

:root {
    --primary-color: #a855f7;
    --primary-hover: #9333ea;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --bg-primary: rgba(15, 15, 25, 0.85);
    --bg-secondary: #0a0a0f;
    --border-color: #374151;
    --success-color: #10b981;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: transparent;
    min-height: 100vh;
    padding: 20px;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 48px;
    padding-top: 40px;
}

.title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Input Section */
.input-section {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
}

.idea-input {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    line-height: 1.6;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 16px;
    background: #1a1a2e;
    color: var(--text-primary);
}

.idea-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

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

.char-count {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.char-count.warning {
    color: #f59e0b;
}

.char-count.error {
    color: var(--primary-color);
}

.analyze-btn {
    width: 100%;
    padding: 16px 32px;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

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

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

.analyze-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.secondary-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: #000;
}

.secondary-btn.accent {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

/* Result action buttons */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}

@media (min-width: 480px) {
    .result-actions {
        flex-direction: row;
        justify-content: center;
    }
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 64px 32px;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

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

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

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Results Section */
.results-section {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.expert-card {
    background: linear-gradient(135deg, #3b0764 0%, #1e1b4b 100%);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 32px;
    border-left: 4px solid var(--primary-color);
}

.expert-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.expert-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.expert-title {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.critique-content {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.critique-content h3,
.critique-content h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.critique-content p {
    margin-bottom: 16px;
}

.critique-content strong {
    color: var(--primary-color);
    font-weight: 600;
}

.critique-content ul,
.critique-content ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.critique-content li {
    margin-bottom: 8px;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 64px 32px;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.error-message {
    font-size: 1.125rem;
    color: var(--primary-color);
    margin-bottom: 24px;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 48px;
    padding: 24px;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-section,
    .results-section,
    .loading-state,
    .error-state {
        padding: 24px;
    }

    .analyze-btn {
        padding: 14px 24px;
        font-size: 1rem;
    }

    .expert-name {
        font-size: 1.25rem;
    }

    .critique-content {
        font-size: 1rem;
    }
}

/* Markdown-style formatting for critique */
.critique-content > p:first-of-type strong {
    display: block;
    font-size: 1.125rem;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(88, 28, 135, 0.3);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}
