/* === Variables de couleurs === */
:root {
    --primary-color: #0a66c2;
    --primary-hover: #004182;
    --secondary-color: #6c757d;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-gradient-start: #f0f7ff;
    --bg-gradient-end: #ffffff;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --input-border: #e5e7eb;
    --input-bg: #ffffff;
    --preview-bg-start: #f8fafc;
    --preview-bg-end: #f1f5f9;
    --preview-border: #e2e8f0;
    --footer-bg-start: #f9fafb;
    --footer-bg-end: #f3f4f6;
    --footer-border: #e5e7eb;
}

/* === Dark Mode Variables === */
:root[data-theme="dark"] {
    --primary-color: #4a9eff;
    --primary-hover: #3b82f6;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --card-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --input-border: #334155;
    --input-bg: #0f172a;
    --preview-bg-start: #0f172a;
    --preview-bg-end: #1e293b;
    --preview-border: #334155;
    --footer-bg-start: #1e293b;
    --footer-bg-end: #0f172a;
    --footer-border: #334155;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* === Hero Section === */
.hero-section {
    background: linear-gradient(135deg, #0a66c2 0%, #004182 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 1rem 0;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 400;
    margin: 0;
    line-height: 1.7;
}

/* === Main Container === */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* === Editor Section === */
.editor-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.editor-card,
.preview-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    overflow: hidden;
}

.editor-card:hover,
.preview-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

/* === Info Section === */
.info-section {
    margin-top: 2rem;
}

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

.info-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

/* === Action Section === */
.action-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* === Markdown Input Container === */
.markdown-input-container {
    padding: 2rem;
}

.markdown-textarea {
    font-family: "SF Mono", "Consolas", "Monaco", "Courier New", monospace;
    resize: vertical;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    width: 100%;
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
    transition: var(--transition);
    min-height: 300px;
    background: var(--input-bg);
    color: var(--text-primary);
}

.markdown-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
    outline: none;
}

/* === LinkedIn Preview === */
.linkedin-preview-container {
    padding: 2rem;
}

.linkedin-preview-box {
    background: linear-gradient(135deg, var(--preview-bg-start) 0%, var(--preview-bg-end) 100%);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid var(--preview-border);
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 300px;
    position: relative;
    color: var(--text-primary);
}

.linkedin-preview-box::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-color) 0%, #0e76a8 100%);
    border-radius: 12px 0 0 12px;
}

.linkedin-preview-box .preview-text p {
    margin: 0.35rem 0;
}

.linkedin-preview-box .preview-text p:last-child {
    margin-bottom: 0;
}

/* === Character Counter === */
.character-counter-container {
    margin: 0;
}

.counter-box {
    padding: 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.counter-green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-color: #6ee7b7;
}

.counter-orange {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-color: #fbbf24;
}

.counter-red {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-color: #f87171;
}

.counter-text {
    font-size: 1.2rem;
}

/* === Mobile Warning === */
.mobile-warning-container {
    margin: 0;
}

.alert {
    padding: 1.5rem;
    margin: 0;
    border-radius: 12px;
    border: 2px solid transparent;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fbbf24;
    color: #92400e;
}

.alert strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* === Copy Button === */
.copy-button-container {
    margin: 0;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
    transition: var(--transition);
    box-shadow: var(--card-shadow);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-lg {
    font-size: 1.2rem;
    padding: 1.25rem 3rem;
}

.copy-success-message {
    color: var(--success-color);
    font-weight: 700;
    font-size: 1.1rem;
    animation: fadeIn 0.3s ease;
}

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

/* === Form Elements === */
.form-label {
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: block;
    font-size: 1.1rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
    outline: none;
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

/* === Footer === */
.app-footer {
    background: linear-gradient(135deg, var(--footer-bg-start) 0%, var(--footer-bg-end) 100%);
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--footer-border);
    margin-top: 4rem;
}

.footer-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .editor-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .main-container {
        padding: 2rem 1rem;
    }

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

@media (max-width: 576px) {
    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .markdown-input-container,
    .linkedin-preview-container {
        padding: 1.5rem;
    }

    .btn-lg {
        font-size: 1rem;
        padding: 1rem 2rem;
        width: 100%;
    }

    .editor-card,
    .preview-card {
        border-radius: 12px;
    }
}

/* === Theme Toggle === */
.theme-toggle-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
}

body.focus-mode-active .theme-toggle-container {
    top: auto;
    bottom: 1.5rem;
}

.theme-toggle-btn {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    padding: 0;
}

.theme-toggle-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--card-shadow-hover);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .theme-toggle-container {
        top: 1rem;
        right: 1rem;
    }

    .theme-toggle-btn {
        width: 3rem;
        height: 3rem;
    }

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

/* === Focus Mode === */
.focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.focus-header {
    flex: none;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.focus-header-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-right: auto;
}

.focus-char-count {
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    white-space: nowrap;
}

.focus-counter-green {
    background: #d1fae5;
    color: #065f46;
}

.focus-counter-orange {
    background: #fef3c7;
    color: #92400e;
}

.focus-counter-red {
    background: #fee2e2;
    color: #991b1b;
}

.focus-exit-btn {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}

.focus-exit-btn:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: #fee2e2;
}

.focus-header .copy-button-container {
    margin: 0;
}

.focus-header .btn {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 8px;
}

.focus-header .copy-success-message {
    font-size: 0.875rem;
}

.focus-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.focus-editor-pane {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 2px solid var(--border-color);
}

.focus-preview-pane {
    flex: 0 0 40%;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--card-bg);
}

.focus-preview-pane .linkedin-preview-container {
    padding: 0;
}

@media (max-width: 768px) {
    .focus-toggle-btn {
        display: none !important;
    }
}

/* === Blazor WebAssembly Loading === */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(10, 102, 194, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-container p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* === Blazor Error UI === */
#blazor-error-ui {
    background: #fee2e2;
    border-top: 2px solid #ef4444;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #991b1b;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
    font-size: 1.5rem;
    color: #991b1b;
}

#blazor-error-ui .reload {
    color: #991b1b;
    font-weight: 700;
    text-decoration: underline;
    margin-left: 0.5rem;
}
