/* ===========================================
   Roast My CV - Mobile-First Styles
   =========================================== */

/* CSS Variables */
:root {
    --color-bg: #1a1a2e;
    --color-surface: #16213e;
    --color-surface-light: #1f2b47;
    --color-primary: #e94560;
    --color-primary-hover: #ff6b6b;
    --color-secondary: #ff6b6b;
    --color-accent: #feca57;
    --color-text: #eaeaea;
    --color-text-muted: #a0a0a0;
    --color-success: #2ecc71;
    --color-error: #e74c3c;
    --color-border: #2d3a5a;

    --font-mono: 'Courier New', Courier, monospace;
    --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;

    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition-speed: 0.3s;
}

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

/* Base */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-system);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: var(--spacing-lg) 0;
}

.title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.fire {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

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

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    gap: var(--spacing-md);
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed);
    background: var(--color-surface);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--color-primary);
    background: var(--color-surface-light);
}

.drop-zone.dragover {
    transform: scale(1.02);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--spacing-sm);
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.drop-subtext {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.drop-format {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin-top: var(--spacing-sm);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

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

/* Text Input */
.text-input-wrapper {
    position: relative;
}

.cv-textarea {
    width: 100%;
    min-height: 150px;
    padding: var(--spacing-md);
    padding-bottom: var(--spacing-xl);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--font-system);
    font-size: 1rem;
    resize: vertical;
    transition: border-color var(--transition-speed);
}

.cv-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.cv-textarea::placeholder {
    color: var(--color-text-muted);
}

.char-count {
    position: absolute;
    bottom: var(--spacing-sm);
    right: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.char-count.warning {
    color: var(--color-accent);
}

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

/* File Preview */
.file-preview {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border: 1px solid var(--color-border);
}

.file-preview.hidden {
    display: none;
}

.file-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.file-icon {
    font-size: 1.5rem;
}

.file-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-file {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-error);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: transform var(--transition-speed);
}

.remove-file:hover {
    transform: scale(1.1);
}

.text-preview {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    max-height: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    min-height: 56px;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

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

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
    background: var(--color-surface-light);
}

.btn-outline {
    background: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

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

.btn-icon {
    font-size: 1.25rem;
}

/* Stats */
.stats {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* Loading Screen */
.loading-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-xl);
}

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

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

.loading-message {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    text-align: center;
    animation: fadeInOut 3s ease-in-out infinite;
}

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

/* Result Screen */
.result-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.roast-container {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    border-left: 4px solid var(--color-primary);
}

.roast-text {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.tips-container {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    border-left: 4px solid var(--color-accent);
}

.tips-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-md);
    color: var(--color-accent);
}

.tips-icon {
    font-size: 1.25rem;
}

.tips-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.tips-list li {
    padding-left: var(--spacing-lg);
    position: relative;
}

.tips-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Rate Limited Screen */
.limited-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
}

.limited-icon {
    font-size: 4rem;
}

.limited-title {
    font-size: 1.5rem;
}

.limited-text {
    color: var(--color-text-muted);
}

.countdown {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.limited-subtext {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: var(--spacing-sm);
}

/* Error Screen */
.error-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
}

.error-icon {
    font-size: 4rem;
}

.error-title {
    font-size: 1.5rem;
    color: var(--color-error);
}

.error-message {
    color: var(--color-text-muted);
    max-width: 300px;
}

/* Footer */
.footer {
    text-align: center;
    padding: var(--spacing-lg) 0;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.footer a {
    color: var(--color-primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.disclaimer {
    margin-top: var(--spacing-xs);
    font-size: 0.75rem;
    opacity: 0.7;
}

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

/* Tablet and Desktop */
@media (min-width: 768px) {
    .container {
        padding: var(--spacing-xl);
    }

    .title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .drop-zone {
        min-height: 220px;
        padding: var(--spacing-xl) 40px;
    }

    .result-actions {
        flex-direction: row;
    }

    .result-actions .btn {
        flex: 1;
    }
}

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

/* Dark mode already default, but ensure system preference */
@media (prefers-color-scheme: light) {
    /* Keep dark theme - it's part of the brand */
}
