/**
 * Yuri Nuresi - Portfolio Interattivo
 * Design System - Dual Theme (Blue/Green)
 * Mobile-first approach
 */

/* ================================
   CSS Variables & Themes
   ================================ */

:root {
    /* Base colors */
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: #1a2332;

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --border-color: #374151;
    --border-light: #4b5563;

    /* Font */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* Blue Theme (Default) */
[data-theme="blue"] {
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-tertiary: #1d4ed8;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --bg-primary: #0a0f1a;
    --bg-secondary: #0d1424;
    --bg-card: #111c2e;
}

/* Green Theme */
[data-theme="green"] {
    --accent-primary: #10b981;
    --accent-secondary: #34d399;
    --accent-tertiary: #059669;
    --accent-glow: rgba(16, 185, 129, 0.3);
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --bg-primary: #0a1a14;
    --bg-secondary: #0d1f17;
    --bg-card: #112b1f;
}

/* ================================
   Reset & Base
   ================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================================
   Typography
   ================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

@media (min-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
}

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
}

/* ================================
   Layout
   ================================ */

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.main-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Mobile: Terminal at bottom */
.content-area {
    flex: 1;
    padding: var(--space-md);
    padding-bottom: 320px; /* Space for terminal */
}

.terminal-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 300px;
    z-index: 100;
}

/* Desktop: Side by side */
@media (min-width: 1024px) {
    .main-layout {
        flex-direction: row;
    }

    .content-area {
        flex: 1;
        padding: var(--space-xl);
        padding-bottom: var(--space-xl);
        margin-left: 420px; /* Space for fixed terminal on left */
    }

    .terminal-wrapper {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 400px;
        height: 100vh;
    }
}

/* ================================
   Header
   ================================ */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md);
    position: sticky;
    top: 0;
    z-index: 50;
}

@media (min-width: 1024px) {
    .header {
        margin-left: 400px; /* Space for fixed terminal on left */
    }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent-primary);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-tertiary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.theme-btn {
    background: none;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.theme-btn.active {
    background: var(--accent-primary);
    color: white;
}

.theme-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* ================================
   Terminal / Chatbot
   ================================ */

.terminal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

@media (min-width: 1024px) {
    .terminal {
        border-radius: 0;
        border-left: 1px solid var(--border-color);
        border-top: none;
        border-bottom: none;
        border-right: none;
    }
}

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

@media (min-width: 1024px) {
    .terminal-header {
        border-radius: 0;
    }
}

.terminal-dots {
    display: flex;
    gap: var(--space-xs);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #eab308; }
.terminal-dot.green { background: #22c55e; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.terminal-line {
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.terminal-prompt {
    color: var(--accent-primary);
}

.terminal-text {
    color: var(--text-secondary);
}

.terminal-response {
    color: var(--text-primary);
    padding-left: var(--space-md);
    border-left: 2px solid var(--accent-primary);
    margin: var(--space-sm) 0;
}

.terminal-input-wrapper {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.terminal-input-prompt {
    color: var(--accent-primary);
    font-family: var(--font-mono);
    margin-right: var(--space-sm);
}

.terminal-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    outline: none;
}

.terminal-input::placeholder {
    color: var(--text-muted);
}

/* ================================
   Storytelling Sections
   ================================ */

.story-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    transition: all var(--transition-normal);
}

.story-section:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    color: var(--accent-primary);
}

.section-icon {
    width: 24px;
    height: 24px;
}

/* ================================
   Choice Cards (Storytelling)
   ================================ */

.choices-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

@media (min-width: 640px) {
    .choices-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .choices-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.choice-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.choice-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.choice-card.active {
    border-color: var(--accent-primary);
    background: var(--accent-gradient);
}

.choice-card.active .choice-title,
.choice-card.active .choice-desc {
    color: white;
}

.choice-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.choice-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.choice-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ================================
   Skills
   ================================ */

.skills-category {
    margin-bottom: var(--space-xl);
}

.skills-category-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    font-size: 1.1rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

@media (min-width: 640px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.skill-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all var(--transition-fast);
}

.skill-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.skill-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.skill-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.skill-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.skill-name {
    font-weight: 500;
    color: var(--text-primary);
}

.skill-level {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.skill-track {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.8s ease-out;
    box-shadow: 0 0 8px currentColor;
}

/* Old skill-bar for compatibility */
.skill-bar {
    margin-bottom: var(--space-md);
}

.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

/* ================================
   Timeline (Experience)
   ================================ */

.timeline {
    position: relative;
    padding-left: var(--space-xl);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-xl);
}

.timeline-dot {
    position: absolute;
    left: calc(-1 * var(--space-xl) + 4px);
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.timeline-item.current .timeline-dot {
    box-shadow: 0 0 10px var(--accent-primary);
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.timeline-company {
    font-weight: 600;
    color: var(--accent-primary);
}

.timeline-role {
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.timeline-period {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.timeline-tasks {
    list-style: none;
}

.timeline-tasks li {
    position: relative;
    padding-left: var(--space-md);
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.timeline-tasks li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

/* ================================
   Language Rating
   ================================ */

.language-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.language-info h4 {
    color: var(--text-primary);
}

.language-info span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.language-stars {
    display: flex;
    gap: 2px;
}

.star {
    color: var(--border-color);
}

.star.filled {
    color: var(--accent-primary);
}

/* ================================
   Buttons
   ================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
}

/* ================================
   Animations
   ================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade {
    animation: fadeIn var(--transition-normal) ease forwards;
}

.animate-slide {
    animation: slideIn var(--transition-normal) ease forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Stagger children animations */
.stagger-children > * {
    opacity: 1;
    animation: fadeIn 0.3s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }

/* ================================
   Scrollbar
   ================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ================================
   Utilities
   ================================ */

.text-accent { color: var(--accent-primary); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
.hidden { display: none; }

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
