/* =====================================================
   Nicolas Loiseau - Portfolio
   Base Styles & Common Components
   ===================================================== */

/* CSS Variables - Dark Theme (default) */
:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161e;

    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --accent-primary: #22c55e;
    --accent-secondary: #10b981;
    --accent-glow: rgba(34, 197, 94, 0.3);

    --border-color: #27272a;
    --border-accent: #22c55e;

    /* Terminal Colors */
    --terminal-bg: #0d1117;
    --terminal-border: #30363d;
    --terminal-header: #161b22;
    --terminal-dot-red: #ff5f56;
    --terminal-dot-yellow: #ffbd2e;
    --terminal-dot-green: #27c93f;
    --terminal-prompt: #22c55e;
    --terminal-command: #e4e4e7;
    --terminal-output: #a1a1aa;
    --terminal-cursor: #22c55e;

    /* 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);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;

    /* Typography */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --nav-height: 60px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #f4f4f5;
    --bg-tertiary: #e4e4e7;
    --bg-card: #ffffff;

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #71717a;

    --accent-primary: #16a34a;
    --accent-secondary: #059669;
    --accent-glow: rgba(22, 163, 74, 0.2);

    --border-color: #d4d4d8;
    --border-accent: #16a34a;

    --terminal-bg: #f6f8fa;
    --terminal-border: #d0d7de;
    --terminal-header: #f6f8fa;
    --terminal-prompt: #16a34a;
    --terminal-command: #18181b;
    --terminal-output: #52525b;
    --terminal-cursor: #16a34a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

/* =====================================================
   Site Mode Variants (Terminal / Clean / Neural)
   ===================================================== */

/* Clean Mode - Professional/Corporate */
[data-mode="clean"] {
    --accent-primary: #3b82f6;
    --accent-secondary: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --border-accent: #3b82f6;
}

[data-mode="clean"][data-theme="light"] {
    --accent-primary: #2563eb;
    --accent-secondary: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.2);
    --border-accent: #2563eb;
}

/* Neural Mode - AI/Medical/3D */
[data-mode="neural"] {
    --accent-primary: #06b6d4;
    --accent-secondary: #8b5cf6;
    --accent-glow: rgba(6, 182, 212, 0.3);
    --border-accent: #06b6d4;

    /* Neural specific colors */
    --neural-cyan: #06b6d4;
    --neural-purple: #8b5cf6;
    --neural-pink: #ec4899;
    --neural-gradient: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 50%, #ec4899 100%);
    --neural-gradient-subtle: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

[data-mode="neural"][data-theme="light"] {
    --accent-primary: #0891b2;
    --accent-secondary: #7c3aed;
    --accent-glow: rgba(8, 145, 178, 0.2);
    --border-accent: #0891b2;

    --neural-cyan: #0891b2;
    --neural-purple: #7c3aed;
    --neural-pink: #db2777;
}

/* Mode-specific typography */
[data-mode="clean"] .sidebar-logo a::before,
[data-mode="clean"] .page-title::before {
    display: none;
}

[data-mode="clean"] .sidebar-nav-link::before {
    content: '';
}

[data-mode="neural"] .sidebar-logo a::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--neural-gradient);
    border-radius: 50%;
    margin-right: 8px;
    animation: neuralPulse 2s ease-in-out infinite;
}

[data-mode="neural"] .page-title::before {
    content: '';
}

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

/* Neural gradient text for titles */
[data-mode="neural"] .sidebar-logo a,
[data-mode="neural"] .info-content .title {
    background: var(--neural-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =====================================================
   Base Styles
   ===================================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

::selection {
    background-color: var(--accent-primary);
    color: var(--bg-primary);
}

/* =====================================================
   Navigation
   ===================================================== */

.navbar {
    display: none;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Control buttons */
.control-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 34px;
    box-sizing: border-box;
}

.control-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.lang-btn {
    gap: 0.25rem;
}

.lang-btn svg {
    width: 10px;
    height: 10px;
    opacity: 0.6;
}

.theme-btn {
    font-size: 1rem;
    padding: 0 0.5rem;
    min-width: 34px;
}

/* Mode Selector Dropdown */
.mode-selector {
    position: relative;
}

.mode-btn {
    gap: 0.25rem;
}

.mode-btn svg {
    width: 10px;
    height: 10px;
    opacity: 0.6;
    transition: transform var(--transition-fast);
}

.mode-selector.active .mode-btn svg {
    transform: rotate(180deg);
}

.mode-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.mode-selector.active .mode-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.mode-option:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.mode-option.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.mode-option-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* Mode indicator colors */
.mode-option[data-mode="terminal"] .mode-option-icon { color: #22c55e; }
.mode-option[data-mode="clean"] .mode-option-icon { color: #3b82f6; }
.mode-option[data-mode="neural"] .mode-option-icon {
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =====================================================
   Main Content
   ===================================================== */

main {
    padding-top: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* =====================================================
   Page Header
   ===================================================== */

.page-header {
    text-align: center;
    padding: 4rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.page-title::before {
    content: '$ ';
    color: var(--text-muted);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* =====================================================
   Footer
   ===================================================== */

.footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--accent-primary);
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-text .accent {
    color: var(--accent-primary);
}

/* =====================================================
   Utilities & Animations
   ===================================================== */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scroll reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading screen */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-text {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-size: 1.2rem;
}

.loader-text::after {
    content: '_';
    animation: blink 0.7s infinite;
}

/* =====================================================
   Sidebar - Floating Card Style
   ===================================================== */

.sidebar {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 280px;
    max-height: calc(100vh - 40px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

@media (min-width: 1320px) {
    .sidebar {
        left: calc(20px + (100vw - 1320px) / 4);
    }
}

.sidebar.collapsed {
    transform: translateY(-50%) translateX(-120%);
}

.has-sidebar main {
    margin-left: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.has-sidebar main > * {
    width: 100%;
    max-width: 1000px;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateY(-50%) translateX(-120%);
    }

    .sidebar.active {
        transform: translateY(-50%) translateX(0);
    }

    .has-sidebar main {
        margin-left: 0;
    }
}

@media (max-width: 580px) {
    .sidebar {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
    }
}

/* Sidebar Logo */
.sidebar-logo {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo a {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-logo a::before {
    content: '>';
    animation: blink 1s infinite;
}

/* Sidebar Controls */
.sidebar-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* Sidebar Info */
.sidebar-info {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-info .subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.avatar-box {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.avatar-box img {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    border: 3px solid var(--border-color);
    object-fit: cover;
    background: var(--bg-tertiary);
}

.active-status {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.info-content .name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.info-content .title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    display: inline-block;
}

/* Quick Contact Icons */
.quick-contacts {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.quick-contacts-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.quick-contact-btn {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    padding: 0;
}

.quick-contact-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

.quick-contact-btn svg {
    width: 14px;
    height: 14px;
}

.quick-contact-btn.copied {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

/* Tooltip */
.quick-contact-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.quick-contact-btn:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem;
}

.sidebar-nav-list {
    list-style: none;
}

.sidebar-nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.sidebar-nav-link::before {
    content: './';
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

.sidebar-nav-link:hover::before,
.sidebar-nav-link.active::before {
    opacity: 1;
    color: var(--accent-primary);
}

.sidebar-nav-link svg {
    display: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: calc(var(--nav-height) + 1rem);
    left: 1rem;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 101;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }
}

/* =====================================================
   Mobile Bottom Navigation
   ===================================================== */

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-list {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    list-style: none;
    padding: 0 0.5rem;
}

.mobile-nav-item {
    flex: 1;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    transition: color var(--transition-fast);
}

.mobile-nav-link svg {
    width: 22px;
    height: 22px;
    transition: transform var(--transition-fast);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--accent-primary);
}

.mobile-nav-link.active svg {
    transform: scale(1.1);
}

/* Mobile Profile Button (center of nav) */
.mobile-nav-profile {
    flex: 0 0 auto;
    position: relative;
}

.mobile-profile-btn {
    display: block;
    position: relative;
    top: -20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
    background: var(--bg-card);
    padding: 0;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.mobile-profile-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.mobile-profile-btn:hover,
.mobile-profile-btn:active {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 30px var(--accent-glow);
}

/* Neural mode profile button */
[data-mode="neural"] .mobile-profile-btn {
    border-color: var(--neural-cyan);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(6, 182, 212, 0.3);
}

/* Clean mode profile button */
[data-mode="clean"] .mobile-profile-btn {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .mobile-nav {
        display: block;
    }

    .sidebar-toggle {
        display: none !important;
    }

    .nav-links {
        display: none !important;
    }

    .nav-toggle {
        display: none !important;
    }

    main {
        padding-bottom: 80px;
    }

    .footer {
        padding-bottom: calc(80px + 2rem);
    }

    /* Sidebar mobile - enable scrolling */
    .sidebar {
        position: fixed;
        top: 20px;
        left: 20px;
        right: 20px;
        bottom: 100px;
        width: calc(100% - 40px);
        max-height: calc(100vh - 120px);
        transform: translateX(-120%);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Sidebar navigation - Grid 2x2 layout */
    .sidebar-nav-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .sidebar-nav-item {
        margin-bottom: 0;
    }

    .sidebar-nav-link {
        justify-content: center;
        padding: 0.75rem 0.5rem;
        text-align: center;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }

    .sidebar-nav-link::before {
        display: none;
    }

    .sidebar-nav-link:hover,
    .sidebar-nav-link.active {
        border-color: var(--accent-primary);
    }
}

/* =====================================================
   Layout Adjustments
   ===================================================== */

@media (min-width: 1025px) {
    .has-sidebar .page-header {
        padding-left: 2rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .nav-controls,
    .footer,
    .sidebar,
    .mobile-nav,
    .sidebar-toggle {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .has-sidebar main {
        margin-right: 0;
    }

    .cv-item,
    .timeline-card {
        break-inside: avoid;
    }
}

/* =====================================================
   Floating Contact Button
   ===================================================== */

.floating-contact {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.floating-contact:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.5);
}

.floating-contact svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.floating-contact span {
    display: inline;
}

/* Hide on mobile (nav bar already has contact) */
@media (max-width: 768px) {
    .floating-contact {
        bottom: 5rem;
        right: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .floating-contact span {
        display: none;
    }

    .floating-contact {
        padding: 0.75rem;
        border-radius: 50%;
    }
}
