:root {
    --bg-color: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --secondary: #8b5cf6;
    --accent: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

/* Scoped Styles for Main Content to avoid conflicting with Sidebar */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

#main {
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 20%);
    min-height: 100vh;
}

/* Custom Reset for Project Section */
.project-container * {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Specific sizing for slider and card images to keep them uniform */
.portfolio-details-slider .swiper-slide img,
.glass-card img {
    max-height: 500px;
    width: auto;
    object-fit: contain;
}

/* Utility */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Top Bar for Try App Live */
.top-bar {
    padding: 2rem 0;
    display: flex;
    justify-content: flex-end;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* Hero */
.hero-section {
    padding: 4rem 0 6rem;
    text-align: center;
    position: relative;
}

.hero-section h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text-main);
    font-weight: 700;
}

.hero-section h1 span {
    background: linear-gradient(to right, var(--primary), var(--secondary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.6;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 6rem;
}

.stat-item h3 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.stat-item p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Architecture Section */
.architecture-section {
    margin-bottom: 8rem;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    font-weight: 700;
}

.section-header h2::after {
    display: none;
}

.flow-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 3rem;
    border-radius: 30px;
    background: rgba(0, 0, 0, 0.2);
    position: relative;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 2;
}

.step-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--card-bg), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--card-border);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.arrow {
    font-size: 2rem;
    color: var(--text-muted);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.3;
        transform: translateX(0);
    }

    50% {
        opacity: 1;
        transform: translateX(5px);
    }

    100% {
        opacity: 0.3;
        transform: translateX(0);
    }
}

/* Models Table/Cards - Spreading Effect */
.models-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 4rem 0;
    perspective: 1000px;
}

@media (max-width: 991px) {
    .models-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
        padding: 2rem 0;
    }

    .model-card {
        margin-left: 0 !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

.model-card {
    width: 280px !important;
    height: 380px !important;
    flex-shrink: 0;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-left: -60px;
    transform-origin: bottom center;
    z-index: 1;
}

.model-card:nth-child(1) {
    transform: rotate(-10deg) translateY(20px);
    z-index: 1;
}

.model-card:nth-child(2) {
    transform: rotate(-5deg) translateY(10px);
    z-index: 2;
}

.model-card:nth-child(3) {
    transform: rotate(0deg) translateY(0px);
    z-index: 3;
}

.model-card:nth-child(4) {
    transform: rotate(5deg) translateY(20px);
    z-index: 4;
}

.model-card h4 {
    margin: 0;
    font-weight: 700;
    color: var(--text-main);
    transition: all 0.4s ease;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    padding: 0 1rem;
    z-index: 2;
}

.model-card p,
.model-card .accuracy-badge,
.model-card span {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.models-grid:hover .model-card {
    margin-left: 20px;
    transform: rotate(0deg) scale(0.95);
    opacity: 0.6;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.models-grid:hover .model-card:first-child {
    margin-left: 0;
}

.models-grid .model-card:hover {
    transform: scale(1.1) translateY(-30px) !important;
    opacity: 1;
    z-index: 100;
    border-color: var(--accent);
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.4);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    justify-content: flex-start;
    padding-top: 6rem;
}

.models-grid .model-card:hover h4 {
    top: 20px;
    transform: translateY(0);
}

.models-grid .model-card:hover p,
.models-grid .model-card:hover .accuracy-badge,
.models-grid .model-card:hover span {
    opacity: 1;
    transform: translateY(0);
}

.models-grid .model-card:hover .accuracy-badge {
    transition-delay: 0.1s;
}

.models-grid .model-card:hover p {
    transition-delay: 0.2s;
}

.model-card:first-child {
    margin-left: 0;
}

.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--card-border);
}

.model-card.winner::before {
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent);
}

.model-card h4 {
    margin-top: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.accuracy-badge {
    font-size: 3rem;
    font-weight: 800;
    margin: 1.5rem 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.winner .accuracy-badge {
    color: var(--accent);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* Deep Dive Styles */
.project-details-section h3 {
    color: var(--text-main);
}

.project-details-section strong {
    color: var(--text-main);
}

/* Interactive Background */
#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: auto;
}

.hero-section>* {
    position: relative;
    z-index: 1;
}

/* Form Styling */
.php-email-form {
    padding: 30px;
    background: transparent !important;
    /* Critical override for style.css */
    box-shadow: none !important;
    /* Remove duplicate shadow from style.css */
}

.php-email-form .form-group {
    margin-bottom: 25px;
    position: relative;
}

.php-email-form label {
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: block;
    transition: 0.3s;
}

.php-email-form input,
.php-email-form textarea {
    width: 100%;
    border-radius: 8px;
    /* Slightly sharper for technical feel */
    box-shadow: none;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.03);
    /* More transparent */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 15px 15px;
    /* More roomy */
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.php-email-form input:focus,
.php-email-form textarea:focus {
    background: rgba(15, 23, 42, 0.6);
    /* Darker on focus for contrast */
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    /* Soft glow ring */
    outline: none;
}

.php-email-form input:focus+label,
.php-email-form textarea:focus+label {
    color: var(--primary);
}

.php-email-form button[type="submit"] {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border: 0;
    padding: 14px 40px;
    color: #fff;
    transition: 0.4s;
    border-radius: 50px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 1px;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.3);
    display: block;
    margin: 30px auto 0;
    width: 100%;
    max-width: 300px;
    text-transform: uppercase;
}

.php-email-form button[type="submit"]:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.5);
    /* Violet glow */
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    /* Reverse gradient */
}

/* Loading/Error overrides */
.php-email-form .loading,
.php-email-form .error-message,
.php-email-form .sent-message {
    background: rgba(15, 23, 42, 0.9);
    border-color: var(--card-border);
}

.php-email-form .loading:before {
    content: "";
    display: inline-block;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    margin: 0 10px -6px 0;
    border: 3px solid var(--accent);
    border-top-color: transparent;
    animation: animate-loading 1s linear infinite;
}

@keyframes animate-loading {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Custom Morphing Button Animation */
.php-email-form button[type="submit"] {
    position: relative;
    height: 54px;
    /* Fixed height for animation stability */
    transition: all 0.3s ease;
    overflow: hidden;
}

.php-email-form button[type="submit"].animating {
    animation: extend 1s ease-in-out forwards;
    cursor: default;
    pointer-events: none;
    color: transparent !important;
    /* Force text hide */
}

/* Loader Icon inside Button */
.php-email-form button[type="submit"].animating::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -12px;
    margin-left: -12px;
    width: 24px;
    height: 24px;
    border: 3px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 1 !important;
    /* Force show */
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes extend {
    0% {
        width: 100%;
        max-width: 300px;
        border-radius: 50px;
    }

    10% {
        width: 310px;
        background: #fff;
    }

    20% {
        width: 300px;
        background: var(--primary);
    }

    100% {
        width: 54px;
        max-width: 54px;
        border-radius: 50%;
        background: var(--accent);
    }
}

/* Sidebar Styling Overrides */
#header {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(10px);
}

@media (min-width: 1199px) {
    #header {
        background: rgba(15, 23, 42, 0.5) !important;
    }
}

/* Sidebar Toggle Desktop */
.sidebar-toggle {
    position: fixed;
    left: 260px;
    top: 20px;
    width: 35px;
    height: 35px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.5s ease-in-out;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.sidebar-toggle:hover {
    background: var(--secondary);
    transform: scale(1.1);
}

/* Minimized State */
body.sidebar-minimized #header {
    left: -300px;
}

body.sidebar-minimized #main {
    margin-left: 0;
}

body.sidebar-minimized .sidebar-toggle {
    left: 20px;
    transform: rotate(180deg);
}

/* Add transition to main for smooth resize */
#main {
    transition: margin-left 0.5s ease-in-out;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.skill-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    cursor: default;
    /* Glassmorphism subtle glow */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.skill-card i {
    font-size: 2.5rem;
    /* Gradient Icon Color */
    background: linear-gradient(to bottom right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}

.skill-card span {
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
    text-align: center;
}

.skill-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.skill-card:hover i {
    transform: scale(1.1);
    /* Remove gradient on hover for specific brand colors if desired, 
       but keeping gradient glow for now */
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}