/**
 * Main CSS File for Tanish Sharma Portfolio
 * * This file contains all styling for the portfolio website.
 * It includes:
 * - CSS Variables for theming
 * - Base styles and typography
 * - Component styles
 * - Dark/Light theme implementations
 * - Responsive design utilities
 * * Author: Tanish Sharma
 * Version: 2.0
 */

/* ===== IMPORTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=JetBrains+Mono:wght@400;700&display=swap');

/* ===== CSS VARIABLES FOR THEMING ===== */
:root {
    /* Typography */
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Brand Colors */
    --color-primary: #3b82f6;      /* Primary blue */
    --color-secondary: #8b5cf6;    /* Purple accent */
    --color-accent: #10b981;       /* Green accent */
    --color-warning: #f59e0b;      /* Amber warning */
    --color-error: #ef4444;        /* Red error */
    --color-success: #22c55e;      /* Emerald success */
    --color-info: #06b6d4;         /* Cyan info */
    
    /* Light Theme Colors */
    --light-background: #f9fafb;
    --light-foreground: #0f172a;
    --light-foreground-muted: #475569;
    --light-layer-100: #ffffff;
    --light-layer-200: #f3f4f6;
    --light-layer-300: #e5e7eb;
    --light-border: #d1d5db;

    /* Dark Theme Colors - Deep Dark Theme */
    --dark-background: #0f0f0f;
    --dark-foreground: #ffffff;
    --dark-foreground-muted: #9ca3af;
    --dark-layer-100: #0f0f0f;
    --dark-layer-200: #1a1a1a;
    --dark-layer-300: #2a2a2a;
    --dark-border: #333333;
    
    /* Animation & Transition */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Spacing Scale */
    --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 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== THEME IMPLEMENTATIONS ===== */
html.dark {
    --background: var(--dark-background);
    --foreground: var(--dark-foreground);
    --foreground-muted: var(--dark-foreground-muted);
    --layer-100: var(--dark-layer-100);
    --layer-200: var(--dark-layer-200);
    --layer-300: var(--dark-layer-300);
    --border-color: var(--dark-border);
}

html.light {
    --background: var(--light-background);
    --foreground: var(--light-foreground);
    --foreground-muted: var(--light-foreground-muted);
    --layer-100: var(--light-layer-100);
    --layer-200: var(--light-layer-200);
    --layer-300: var(--light-layer-300);
    --border-color: var(--light-border);
}

/* ===== BASE STYLES ===== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--background);
    /* Add subtle gradient overlay for visual depth */
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
    color: var(--foreground);
    font-family: var(--font-sans);
    transition: all var(--transition-normal);
    line-height: 1.6;
    font-size: 16px;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 0.5em;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--foreground);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
}

h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 600;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
}

p {
    line-height: 1.7;
    margin-bottom: var(--space-md);
    color: var(--foreground);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-secondary);
}

/* ===== UTILITY CLASSES ===== */
.bg-background { background-color: var(--background); }
.bg-layer-100 { background-color: var(--layer-100); }
.bg-layer-200 { background-color: var(--layer-200); }
.bg-layer-300 { background-color: var(--layer-300); }

.text-foreground { color: var(--foreground); }
.text-foreground-muted { color: var(--foreground-muted); }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.border-layer-300 { border-color: var(--border-color); }

.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-sans); }

/* ===== HEADER AND NAVIGATION ===== */
.header {
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    transition: all var(--transition-normal);
}

.light .header {
    background-color: rgba(249, 250, 251, 0.95);
}

.nav-link {
    font-family: var(--font-mono);
    color: var(--foreground-muted);
    transition: all var(--transition-fast);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    position: relative;
}

.nav-link:hover {
    color: var(--color-primary);
    background-color: var(--layer-200);
    transform: translateY(-1px);
}

.nav-link.active {
    color: var(--color-primary);
    font-weight: bold;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background-color: var(--color-primary);
    border-radius: 50%;
}

/* Mobile Navigation Toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--foreground);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.nav-toggle:hover {
    color: var(--color-primary);
}

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

/* ===== TERMINAL COMPONENT ===== */
.terminal {
    background-color: var(--layer-100);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-family: var(--font-mono);
    box-shadow: var(--shadow-lg);
}

.terminal-header {
    background-color: var(--layer-200);
    padding: 2px 4px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.terminal-controls {
    display: flex;
    gap: var(--space-xs);
}

.terminal-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.terminal-btn.close { background-color: #ff5f57; }
.terminal-btn.minimize { background-color: #ffbd2e; }
.terminal-btn.maximize { background-color: #28ca42; }

.terminal-title {
    color: var(--foreground-muted);
    font-size: 0.875rem;
    margin-left: var(--space-md);
}

#terminal-body {
    padding: 2px;
    min-height: 200px;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

#terminal-body::-webkit-scrollbar {
    width: 6px;
}

#terminal-body::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.prompt {
    color: var(--color-accent);
    font-weight: 600;
}

.command {
    color: var(--foreground);
    font-weight: 500;
}

.output {
    color: var(--foreground-muted);
    margin-left: var(--space-md);
}

#cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.2em;
    background: var(--color-primary);
    animation: blink 1s step-end infinite;
    vertical-align: bottom;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ===== CARD COMPONENTS ===== */
.card {
    background-color: var(--layer-100);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-primary);
}

.dark .card:hover {
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform: scaleX(0);
    transition: transform var(--transition-normal);
    transform-origin: left;
}

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

/* ===== BUTTON COMPONENTS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    background-color: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: transparent;
    color: var(--foreground);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--layer-200);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-ghost {
    background-color: transparent;
    color: var(--foreground-muted);
}

.btn-ghost:hover {
    color: var(--color-primary);
    background-color: var(--layer-200);
}


/* ===== CHATBOT COMPONENT ===== */
.floating-chat-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 
        var(--shadow-lg),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 20px rgba(59, 130, 246, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all var(--transition-normal);
    border: none;
}

.floating-chat-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 
        0 15px 40px rgba(59, 130, 246, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 0 30px rgba(59, 130, 246, 0.5);
}

.chat-modal {
    position: fixed;
    bottom: calc(2rem + 76px);
    right: 2rem;
    width: 90vw;
    max-width: 400px;
    height: 70vh;
    max-height: 550px;
    background-color: var(--layer-100);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: 
        var(--shadow-xl),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 50px rgba(0, 0, 0, 0.8);
    z-index: 999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

.chat-modal.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.chat-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    background-color: var(--layer-200);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.chat-messages {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.chat-message {
    margin-bottom: 2px;
}

.chat-message.bot .message-content {
    background-color: var(--layer-200);
    padding: 2px;
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
    display: inline-block;
    max-width: 85%;
    color: var(--foreground);
    font-size: 0.875rem;
    line-height: 1.4;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    padding: var(--space-md);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
    display: inline-block;
    max-width: 85%;
    margin-left: auto;
    font-size: 0.875rem;
    line-height: 1.4;
}

.chat-message.user {
    text-align: right;
}

.chat-input-container {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
    background-color: var(--layer-200);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
    }
    
    .card {
        padding: var(--space-md);
    }
    
    .floating-chat-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .chat-modal {
        width: 95vw;
        height: 80vh;
        right: 2.5vw;
    }
}
/* Comprehensive mobile-friendly improvements */
@media (max-width: 600px) {
    .header {
        padding: 0.5rem 0.5rem;
        border-radius: 0;
        position: static;
    }
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
        margin-bottom: 0.5rem;
        display: block;
        text-align: left;
    }
    nav {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
    }
    .card {
        margin-bottom: 1.2rem;
        box-shadow: var(--shadow-md);
    }
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }
    .chat-modal {
        max-width: 100vw;
        height: 90vh;
        right: 0;
        left: 0;
        border-radius: 0;
        padding: 0.5rem;
    }
    .chat-header, .chat-messages, .chat-input-container {
        padding: 0.5rem !important;
    }
    h1, h2, h3, h4 {
        margin-top: 1.2rem;
        margin-bottom: 0.7rem;
        text-align: left;
    }
    section, main {
        padding: 0.5rem 0.5rem;
    }
    img, svg {
        max-width: 100%;
        height: auto;
    }
    .terminal {
        font-size: 0.95rem;
        padding: 0.5rem;
    }
    .terminal-header {
        padding: 0.5rem;
    }
    #terminal-body {
        padding: 0.5rem;
    }
}
/* Extra mobile-friendly tweaks */
@media (max-width: 480px) {
    body {
        font-size: 15px;
        padding: 0 2vw;
    }
    h1 {
        font-size: 2rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    h3 {
        font-size: 1.2rem;
    }
    .card {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    .chat-modal {
        padding: 0.5rem;
    }
    .chat-header, .chat-messages, .chat-input-container {
        padding: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .chat-modal {
        width: 100vw;
        height: 100vh;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
}

/* ===== DARK MODE SPECIFIC ENHANCEMENTS ===== */
.dark {
    /* Enhanced scrollbar for dark mode */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.dark ::-webkit-scrollbar {
    width: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: transparent;
}

.dark ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ===== UTILITY ANIMATIONS ===== */
.hover-lift {
    transition: transform var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ===== LOADING STATES ===== */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .header,
    .floating-chat-btn,
    .chat-modal,
    .nav-toggle {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}