/**
 * Components
 * Cards, Buttons, Forms, Quiz, etc.
 * Design Premium Arancio-Nero
 */

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    letter-spacing: 0.02em;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    
    /* Default: Primary */
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled::before {
    display: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.btn-success {
    background: var(--success);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--warning);
    color: var(--bg-darkest);
}

.btn-danger {
    background: var(--danger);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    box-shadow: none;
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

/* === CARDS === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    margin: var(--space-4) 0;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-light);
}

.card-info {
    border-left: 4px solid var(--info);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, var(--bg-card) 100%);
}

.card-warning {
    border-left: 4px solid var(--warning);
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.1) 0%, var(--bg-card) 100%);
}

.card-success {
    border-left: 4px solid var(--success);
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.1) 0%, var(--bg-card) 100%);
}

.card-danger {
    border-left: 4px solid var(--danger);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-card) 100%);
}

.card-primary {
    border-left: 4px solid var(--primary);
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.1) 0%, var(--bg-card) 100%);
}

.card-docs {
    border-left: 4px solid #8b5cf6;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, var(--bg-card) 100%);
    padding: var(--space-4);
    margin: var(--space-4) 0;
}

.card-docs p {
    margin: 0;
}

.card-docs p:first-child {
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
}

.card-docs a {
    color: #a78bfa;
    font-weight: var(--font-bold);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.card-docs a:hover {
    color: #c4b5fd;
    border-bottom-color: #c4b5fd;
}

.card-docs .text-muted {
    font-size: var(--text-sm);
    opacity: 0.8;
}

/* === DOC PAGE SECTIONS === */
.doc-section {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(340px, 1.1fr);
    gap: var(--space-12);
    align-items: stretch;
    width: min(1200px, 100%);
    margin: var(--space-14) auto;
    padding: var(--space-10);
    background: linear-gradient(140deg, rgba(15, 17, 28, 0.95), rgba(15, 20, 35, 0.88));
    border-radius: var(--radius-2xl, 32px);
    border: 1px solid var(--border-light);
    position: relative;
    box-shadow: 0 35px 80px rgba(0, 0, 0, 0.4);
}

.doc-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-2xl, 32px) var(--radius-2xl, 32px) 0 0;
}

.doc-section.alt .doc-section-text {
    order: 2;
}

.doc-section.alt .doc-section-code {
    order: 1;
}

.doc-section-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    justify-content: center;
    padding-right: var(--space-4);
}

.doc-section-text h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.doc-section-text h4 {
    font-size: clamp(1.25rem, 2.5vw, 1.6rem);
    color: var(--text-primary);
    margin: var(--space-2) 0;
}

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

.doc-section-code {
    background: rgba(3, 7, 18, 0.85);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    align-items: stretch;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.doc-section-code pre {
    margin: 0;
    width: 100%;
    overflow-x: auto;
}

.doc-section-code code {
    font-size: var(--text-sm);
    line-height: 1.7;
}

.doc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-weight: var(--font-bold);
    background: var(--gradient-primary);
    color: var(--text-inverse);
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-md);
}

.doc-list {
    list-style: none;
    margin: var(--space-2) 0;
    padding: 0;
}

.doc-list li {
    position: relative;
    padding-left: var(--space-6);
    margin-bottom: var(--space-2);
}

.doc-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--primary);
    position: absolute;
    left: var(--space-2);
    top: 12px;
}

.doc-note {
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border-left: 4px solid transparent;
    background: rgba(255, 255, 255, 0.02);
    font-size: var(--text-sm);
}

.doc-note strong {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--text-primary);
}

.doc-note.info {
    border-color: var(--info);
    background: rgba(59, 130, 246, 0.08);
}

.doc-note.warning {
    border-color: var(--warning);
    background: rgba(234, 179, 8, 0.08);
}

.doc-note.success {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.08);
}

.doc-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-4);
    align-items: flex-start;
}

.doc-links a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-full);
    background: rgba(167, 139, 250, 0.18);
    color: #d8c9ff;
    font-weight: var(--font-semibold);
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    flex: 0 0 auto;
}

.doc-links a.dartpad-link {
    background: linear-gradient(120deg, rgba(34, 197, 94, 0.25), rgba(16, 185, 129, 0.15));
    color: #d1fae5;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.doc-links a:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    background: rgba(167, 139, 250, 0.28);
}

.doc-links a.dartpad-link:hover {
    background: linear-gradient(120deg, rgba(34, 197, 94, 0.45), rgba(16, 185, 129, 0.25));
}

.doc-divider {
    width: min(1200px, 100%);
    height: 1px;
    margin: var(--space-12) auto;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

@media (max-width: 1024px) {
    .doc-section {
        grid-template-columns: 1fr;
    }
    
    .doc-section.alt .doc-section-text,
    .doc-section.alt .doc-section-code {
        order: unset;
    }
}

/* === SECTION DIVIDER === */
.section-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-14) 0 var(--space-6) 0;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.4), transparent);
}

.section-divider h3 {
    color: var(--text-primary);
    font-size: var(--text-2xl);
    white-space: nowrap;
    margin: 0;
    padding: 0 var(--space-4);
}

/* === MODULE CARDS (Dashboard) === */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-6);
    margin: var(--space-8) 0;
}

.module-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    cursor: pointer;
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-slow);
}

.module-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-glow);
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

.module-card:hover {
    border-color: var(--primary);
    transform: translateY(-12px) scale(1.02);
    box-shadow: var(--shadow-xl), var(--shadow-glow-lg);
}

.module-card:hover::before {
    transform: scaleX(1);
}

.module-card:hover::after {
    opacity: 1;
}

.module-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.module-card.locked:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
}

.module-card.locked:hover::before,
.module-card.locked:hover::after {
    opacity: 0;
    transform: scaleX(0);
}

.module-card.completed {
    border-color: var(--success);
}

.module-card.completed::before {
    background: var(--success);
    transform: scaleX(1);
}

.module-card .module-icon {
    font-size: 4rem;
    margin-bottom: var(--space-5);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.4));
    transition: transform var(--transition-bounce);
}

.module-card:hover .module-icon {
    transform: scale(1.1) rotate(-5deg);
}

.module-card h3 {
    margin: 0 0 var(--space-3) 0;
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text);
}

.module-card p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
    line-height: 1.6;
}

.module-card .module-progress {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.module-card .module-progress .progress-bar {
    flex: 1;
    height: 6px;
}

.module-card .lock-overlay {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    font-size: 1.5rem;
}

/* === TASK CHECKBOX === */
.task {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    margin: var(--space-2) 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.task:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.task input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.task.done {
    opacity: 0.6;
}

.task.done span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* === QUIZ === */
.quiz {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin: var(--space-6) 0;
}

.quiz-question {
    font-weight: var(--font-semibold);
    font-size: var(--text-lg);
    margin-bottom: var(--space-4);
    color: var(--text);
}

.quiz-answer {
    display: none;
    padding: var(--space-4);
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    margin-top: var(--space-4);
    border-left: 4px solid var(--success);
}

.quiz-answer.show {
    display: block;
    animation: fadeIn var(--transition-base);
}

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

/* === PROGRESS BAR === */
.progress-bar {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* === PATH CHOICE CARDS === */
.path-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
    margin: var(--space-6) 0;
}

.path-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    cursor: pointer;
    transition: all var(--transition-slow);
    text-align: center;
}

.path-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.path-card.selected {
    border-color: var(--success);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.1) 0%, var(--bg-card) 100%);
}

.path-card .path-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.path-card h4 {
    margin: 0 0 var(--space-2) 0;
    color: var(--text);
    font-size: var(--text-xl);
}

.path-card p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.path-card ul {
    text-align: left;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* === DIAGRAM === */
.diagram {
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin: var(--space-4) 0;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    overflow-x: auto;
    white-space: pre;
    color: var(--primary-light);
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--gradient-primary);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: var(--bg-darkest);
}

/* === WELCOME MODAL / ONBOARDING === */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn 0.5s ease;
}

.welcome-modal {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-12);
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.welcome-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.welcome-modal::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: var(--gradient-mesh);
    pointer-events: none;
    opacity: 0.5;
}

.welcome-logo {
    font-size: 5rem;
    margin-bottom: var(--space-6);
    filter: drop-shadow(0 10px 30px var(--primary-glow));
    animation: float 3s ease-in-out infinite;
}

.welcome-modal h1 {
    font-size: var(--text-4xl);
    font-weight: var(--font-black);
    margin-bottom: var(--space-2);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-modal .subtitle {
    color: var(--text-muted);
    font-size: var(--text-lg);
    margin-bottom: var(--space-8);
}

/* === FORM INPUTS === */
.form-group {
    margin-bottom: var(--space-5);
    text-align: left;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    outline: none;
    transition: all var(--transition-base);
}

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

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-subtle), var(--shadow-glow);
}

.form-input:hover:not(:focus) {
    border-color: var(--border-light);
}

.form-error {
    color: var(--danger);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* === HERO SECTION === */
.hero {
    text-align: center;
    padding: var(--space-16) var(--space-8);
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.3;
}

.hero-title {
    font-size: var(--text-5xl);
    font-weight: var(--font-black);
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 5s ease infinite;
    background-size: 200% 200%;
}

.hero-subtitle {
    font-size: var(--text-xl);
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto var(--space-8);
}

/* === STATS CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    margin: var(--space-8) 0;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    text-align: center;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-black);
    color: var(--primary);
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* === USER AVATAR === */
.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    color: white;
    box-shadow: var(--shadow-md);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.user-info .user-name {
    font-weight: var(--font-semibold);
    color: var(--text);
}

.user-info .user-status {
    font-size: var(--text-sm);
    color: var(--text-muted);
}
