/* --- CSS Variables for Pastel Color Palette --- */
:root {
    /* Light Mode - Background Colors (F7F1DE for Cards, Darker Warm Main) */
    --color-bg-main: #e5dcc5;
    --color-bg-card: #f7f1de;
    --color-bg-secondary: #ede5cf;
    --color-bg-tertiary: #f0e9d6;
    --color-bg-input: #f4eedb;

    /* Light Mode - Primary Accent (Soft Rose) */
    --color-primary: #e8b4b4;
    --color-primary-hover: #d99a9a;
    --color-primary-active: #c98888;
    --color-primary-light: #f5dede;

    /* Light Mode - Text Colors (Warm Dark Tones) */
    --color-text-primary: #3a3020;
    --color-text-secondary: #5a4f3d;
    --color-text-tertiary: #7a6d59;
    --color-text-muted: #9a8b75;

    /* Status Colors - Pastel */
    --color-success: #a8cebc;
    --color-success-dark: #7db89a;
    --color-error: #e8b4b4;
    --color-error-dark: #d99a9a;
    --color-warning: #f5d5a8;
    --color-warning-dark: #efc47d;
    --color-info: #a8c4d9;
    --color-info-dark: #8db3cd;

    /* Light Mode - Border & Shadow (Warm Tones) */
    --color-border: rgba(58, 48, 32, 0.1);
    --color-border-strong: rgba(58, 48, 32, 0.15);
    --shadow-sm: 0 2px 8px rgba(58, 48, 32, 0.08);
    --shadow-md: 0 4px 16px rgba(58, 48, 32, 0.1);
    --shadow-lg: 0 8px 24px rgba(58, 48, 32, 0.12);
    --shadow-primary: 0 4px 12px rgba(232, 180, 180, 0.18);

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* --- Dark Mode Pastel Color Palette --- */
[data-theme="dark"] {
    /* Dark Mode - Background Colors (Pastel Dark) */
    --color-bg-main: #2d2528;
    --color-bg-card: #3a3235;
    --color-bg-secondary: #453e41;
    --color-bg-tertiary: #362f32;
    --color-bg-input: #403639;

    /* Dark Mode - Primary Accent (Soft Lavender Rose) */
    --color-primary: #d4a5b8;
    --color-primary-hover: #e0b8ca;
    --color-primary-active: #c292a8;
    --color-primary-light: #4a3d44;

    /* Dark Mode - Text Colors */
    --color-text-primary: #f0e6ea;
    --color-text-secondary: #d4c3c9;
    --color-text-tertiary: #b8a3ab;
    --color-text-muted: #8a7780;

    /* Dark Mode - Status Colors (Pastel) */
    --color-success: #a8c9b8;
    --color-success-dark: #c2ddd0;
    --color-error: #d4a5b8;
    --color-error-dark: #e0b8ca;
    --color-warning: #e8cda8;
    --color-warning-dark: #f5ddc2;
    --color-info: #a8c4d9;
    --color-info-dark: #c2d8e8;

    /* Dark Mode - Border & Shadow */
    --color-border: rgba(212, 165, 184, 0.15);
    --color-border-strong: rgba(212, 165, 184, 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 4px 12px rgba(212, 165, 184, 0.3);
}

/* --- Smooth Theme Transitions --- */
* {
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Disable transitions on page load */
.no-transition * {
    transition: none !important;
}

/* --- Basic Setup --- */
body {
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    background-color: var(--color-bg-main);
    color: var(--color-text-primary);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Ensure all elements inherit the font consistently */
*,
*::before,
*::after {
    font-family: inherit;
    box-sizing: border-box; /* Include padding and border in element width */
}

/* Standardize heading styles */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: inherit;
    font-weight: 600;
    line-height: 1.3;
}

/* Standardize button and input fonts */
button,
input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

/* Standardize text elements */
p,
span,
div,
a {
    font-family: inherit;
}

/* --- Navigation Bar --- */
.navbar {
    background-color: var(--color-bg-card);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-logo .logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.navbar-logo img {
    height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);   
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.navbar-logo .logo-link:hover img {
    transform: scale(1.05);
}

.navbar-logo .logo-link:hover .logo-text {
    color: var(--color-primary);
}

.navbar-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    transform: translateY(-2px);
}

.nav-link.active {
    color: var(--color-text-primary);
    background-color: var(--color-primary);
}

.nav-link.active:hover {
    background-color: var(--color-primary-hover);
}

/* --- Hamburger Menu --- */
.hamburger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger-menu span {
    width: 24px;
    height: 3px;
    background-color: var(--color-text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* --- Mobile Menu Dropdown --- */
.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.mobile-menu.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    margin-top: 10px;
}

.mobile-nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 20px;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--color-border);
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-nav-link:hover {
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
}

.mobile-nav-link.active {
    color: var(--color-text-primary);
    background-color: var(--color-primary);
}

/* --- Theme Toggle Button --- */
.theme-toggle {
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border-strong);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Theme toggle icons */
.theme-toggle-icon {
    width: 20px;
    height: 20px;
    position: absolute;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-toggle-icon.sun {
    color: #f5a623;
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle-icon.moon {
    color: #7b68ee;
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

[data-theme="dark"] .theme-toggle-icon.sun {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

[data-theme="dark"] .theme-toggle-icon.moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* SVG icons for theme toggle */
.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Add padding back to body content */
body > *:not(.navbar) {
    padding-left: 24px;
    padding-right: 24px;
}

body > .main-grid {
    padding-top: 24px;
}

body > .header {
    padding-top: 24px;
}

/* --- Header (for About and Contact pages) --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding: 0 10px;
}
.header-text h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--color-text-primary);
}
.header-text .subtitle {
    color: var(--color-text-tertiary);
    margin: 5px 0 0;
    max-width: 500px;
    font-size: 0.9rem;
}
.header .logo {
    width: 90px;
    height: auto;
    margin-right: 20px;
}

/* --- Main Layout Grid --- */
.main-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    max-width: 100%;
    box-sizing: border-box;
}
.left-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Prevent flex items from overflowing */
}

.content-container {
    height: calc(100vh - 82px); /* Full viewport - navbar */
    overflow-y: auto;
    padding: 40px 24px 50px 24px; /* Top/bottom padding for centering + 50px gap */
    box-sizing: border-box;
    display: flex;
    align-items: center; /* Center vertically */
}

/* Custom scrollbar for content container */
.content-container::-webkit-scrollbar {
    width: 10px;
}
.content-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
.content-container::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
    border: 2px solid var(--color-bg-card);
}
.content-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* --- Card Styling --- */
.card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-strong);
}

/* --- 1. Upload Box (Top-Left) --- */
#upload-box {
    display: flex;
    gap: 20px;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.upload-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: space-between;
    min-width: 0;
}
.preview-box {
    flex: 1.2;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    border: 2px dashed var(--color-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 200px;
    height: 200px;
    color: var(--color-text-muted);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.95rem;
    overflow: hidden; /* To contain the image */
    box-sizing: border-box;
}
.preview-box img {
    display: none; /* Hidden by default */
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    object-fit: contain;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Form Elements Styling --- */
.input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
input[type="file"] {
    display: none; /* Hide default input */
}
.file-label {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
}
.file-label:hover {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.file-label:active {
    transform: translateY(0);
}
.icon-btn {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}
.icon-btn:active {
    transform: scale(0.95);
}
#fileNameDisplay {
    color: var(--color-text-secondary);
    font-style: italic;
    font-size: 0.9rem;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none; /* Hidden by default */
}
#clearFile {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    display: none; /* Hidden by default */
    margin-left: 8px;
}
#clearFile:hover {
    color: var(--color-error-dark);
}
.file-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 24px;
}

/* Inline loading spinner */
.inline-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid var(--color-border-strong);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.inline-spinner.active {
    display: inline-block;
}
.btn-group {
    display: flex;
    gap: 10px;
}
.btn {
    background: var(--color-primary);
    color: var(--color-text-primary);
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-primary);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.btn:active:not(:disabled) {
    transform: translateY(0);
    background: var(--color-primary-active);
}
.btn-new {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-strong);
    font-size: 0.95rem;
    box-shadow: none;
}
.btn-new:hover:not(:disabled) {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn-new:active:not(:disabled) {
    transform: translateY(0);
    background-color: var(--color-bg-secondary);
}

/* --- 2. Result Box (Bottom-Left) --- */
#result-box {
    height: 100%;
    max-height: 300px; /* Fixed max height */
    min-height: 250px; /* Minimum height */
    overflow-y: auto;
    overflow-x: hidden;
}
#result-box p {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Custom scrollbar for result box */
#result-box::-webkit-scrollbar {
    width: 10px;
}
#result-box::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
#result-box::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
    border: 2px solid var(--color-bg-card);
}
#result-box::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}
.viz-container {
    display: flex;
    gap: 15px;
}
.viz-box {
    flex: 1;
    background-color: var(--color-bg-secondary);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.95rem;
    overflow: hidden;
    cursor: zoom-in;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    position: relative;
}
.viz-box:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}
.viz-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    transition: transform 0.3s ease;
}
.viz-box:hover img {
    transform: scale(1.05);
}

/* Zoom effect on click */
.viz-box.zoomed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 900px;
    z-index: 9999;
    cursor: zoom-out;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}
.viz-box.zoomed img {
    transform: scale(1);
    object-fit: contain;
}

/* Overlay backdrop when zoomed */
.zoom-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 64, 66, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9998;
}
.zoom-backdrop.active {
    display: block;
}

/* --- 3. Gemini Box (Right) --- */
#gemini-box {
    height: 100%;
    max-height: 100%; /* Use available space */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent overflow from card */
}
#gemini-box h3 {
    margin: 0 0 15px;
    font-size: 1.5rem;
    flex-shrink: 0; /* Prevent title from shrinking */
}
#gemini-box textarea {
    width: 100%;
    flex-grow: 1; /* Makes textarea fill the card */
    min-height: 400px;
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.8;
    resize: vertical;
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease;
    white-space: pre-wrap;
}
#gemini-box textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Gemini content formatting */
.gemini-content {
    width: 100%; /* Full width of parent */
    height: 470px; /* Fixed height - stays same before and after content */
    min-height: 470px; /* Ensure minimum height */
    max-height: 470px; /* Fixed max height to prevent expanding */
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.8;
    overflow-y: auto; /* Enable scrolling */
    overflow-x: hidden; /* Hide horizontal overflow */
    overflow-wrap: break-word; /* Break long words */
    word-break: break-word; /* Break long words */
    box-sizing: border-box; /* Include padding in width */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Custom scrollbar for Gemini content */
.gemini-content::-webkit-scrollbar {
    width: 10px;
}
.gemini-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
.gemini-content::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-bg-input);
}
.gemini-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

.gemini-content h1,
.gemini-content h2,
.gemini-content h3 {
    color: var(--color-success-dark);
    margin: 20px 0 10px 0;
    font-weight: 700;
}
.gemini-content h1 {
    font-size: 1.4rem;
}
.gemini-content h2 {
    font-size: 1.2rem;
}
.gemini-content h3 {
    font-size: 1.1rem;
}
.gemini-content strong {
    color: var(--color-warning-dark);
    font-weight: 700;
}
.gemini-content ul,
.gemini-content ol {
    margin: 10px 0;
    padding-left: 25px;
}
.gemini-content li {
    margin: 5px 0;
}
.gemini-content p {
    margin: 10px 0;
}

/* --- Utility & Result States --- */
.err {
    color: var(--color-error-dark);
    font-weight: 700;
    font-size: 1.2rem;
}
.ok {
    color: var(--color-success-dark);
    font-weight: 700;
    font-size: 1.2rem;
}
.label {
    font-weight: 600;
    color: var(--color-text-secondary);
}
.pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--color-success);
    color: var(--color-text-primary);
    font-weight: 600;
    animation: slideIn 0.4s ease;
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Confidence Bar */
.confidence-bar {
    width: 100%;
    height: 8px;
    background: var(--color-bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 15px 0;
}
.confidence-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--color-primary),
        var(--color-success)
    );
    border-radius: 4px;
    transition: width 0.6s ease;
    animation: fillBar 0.8s ease;
}
@keyframes fillBar {
    from {
        width: 0%;
    }
}
pre {
    white-space: pre-wrap;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-strong);
    padding: 12px;
    border-radius: var(--radius-sm);
}
.footer {
    margin-top: 28px;
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
}

/* --- Contact Form Styling --- */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    background-color: var(--color-bg-input);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-text-muted);
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 64, 66, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.loading-overlay.active {
    display: flex;
}
.spinner {
    border: 4px solid var(--color-bg-secondary);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
.loading-text {
    color: var(--color-text-primary);
    background: var(--color-bg-card);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}
.loading-text::after {
    content: "";
    animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
    0%,
    20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60%,
    100% {
        content: "...";
    }
}

/* Progress Text */
.progress-text {
    color: var(--color-text-primary);
    background: var(--color-bg-card);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    margin-top: 15px;
    font-size: 1rem;
    font-weight: 500;
    min-height: 24px;
}
.progress-text::after {
    content: "";
    animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
    0%,
    20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60%,
    100% {
        content: "...";
    }
}

/* Button disabled state */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation:
        slideInRight 0.3s ease,
        fadeOut 0.3s ease 2.7s;
    border-left: 4px solid var(--color-border-strong);
}

.toast.success {
    border-left-color: var(--color-success-dark);
}

.toast.error {
    border-left-color: var(--color-error-dark);
}

.toast.warning {
    border-left-color: var(--color-warning-dark);
}

.toast.info {
    border-left-color: var(--color-info-dark);
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

/* Mobile responsive toast */
@media (max-width: 768px) {
    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* Camera Modal */
.camera-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 64, 66, 0.97);
    backdrop-filter: blur(12px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}
.camera-modal.active {
    display: flex;
}
.camera-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}
#cameraVideo {
    width: 100%;
    max-width: 100%;
    max-height: 60vh;
    height: auto;
    border-radius: var(--radius-md);
    border: 3px solid var(--color-primary);
    box-shadow: var(--shadow-lg);
    object-fit: cover;
}
#cameraCanvas {
    display: none;
}
.camera-controls {
    display: flex;
    gap: 15px;
    width: 100%;
    max-width: 500px;
    justify-content: center;
    align-items: center;
}
.camera-btn {
    background: var(--color-primary);
    color: var(--color-text-primary);
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-primary);
    flex: 1;
    max-width: 150px;
    white-space: nowrap;
}
.camera-btn:hover {
    background: var(--color-primary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}
.camera-btn.secondary {
    background: var(--color-bg-card);
    border: 2px solid var(--color-border-strong);
}
.camera-btn.secondary:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-primary);
}

/* --- Welcome Modal (Get Started) --- */
.welcome-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 64, 66, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.welcome-modal.active {
    display: flex;
}

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

.welcome-modal-content {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 700px;
    height: 80vh;
    max-height: 650px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease;
    overflow: hidden;
    box-sizing: border-box;
}

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

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    border: 2px solid var(--color-border-strong);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--color-primary);
    color: var(--color-text-primary);
    border-color: var(--color-primary);
    transform: rotate(90deg);
}

.modal-header {
    background: linear-gradient(
        135deg,
        var(--color-bg-secondary) 0%,
        var(--color-bg-card) 100%
    );
    padding: 40px 30px 30px;
    text-align: center;
    flex-shrink: 0;
    border-bottom: 2px solid var(--color-border);
    box-sizing: border-box;
}

.modal-header h2 {
    margin: 0 0 10px;
    font-size: 2rem;
    color: var(--color-text-primary);
    font-weight: 700;
}

.modal-subtitle {
    margin: 0;
    color: var(--color-text-tertiary);
    font-size: 1rem;
    font-weight: 500;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 10px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
    border: 2px solid var(--color-bg-card);
}

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

.modal-section {
    margin-bottom: 30px;
    width: 100%;
    box-sizing: border-box;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h3 {
    color: var(--color-success-dark);
    font-size: 1.3rem;
    margin: 0 0 15px;
    font-weight: 700;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-section h3 .section-icon {
    flex-shrink: 0;
    color: var(--color-primary);
    stroke-width: 2.5;
}

.modal-section p {
    color: var(--color-text-primary);
    line-height: 1.8;
    margin: 10px 0;
    font-size: 0.95rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.modal-section ol,
.modal-section ul {
    color: var(--color-text-primary);
    line-height: 2;
    margin: 10px 0;
    padding-left: 25px;
    width: 100%;
    box-sizing: border-box;
}

.modal-section li {
    margin: 10px 0;
    font-size: 0.95rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.modal-section li strong {
    color: var(--color-warning-dark);
    font-weight: 700;
}

/* Tutorial Steps Styling */
.tutorial-step {
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--color-border);
}

.tutorial-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tutorial-step h4 {
    color: var(--color-primary);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tutorial-step p {
    color: var(--color-text-primary);
    line-height: 1.8;
    margin: 0 0 15px 0;
    font-size: 0.95rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tutorial-image {
    width: 100%;
    margin-top: 15px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--color-border-strong);
    background: var(--color-bg-tertiary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.tutorial-image:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.tutorial-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 400px;
}

/* Info Section Styling */
.modal-info-section {
    background: var(--color-bg-tertiary);
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--color-success-dark);
    box-sizing: border-box;
}

.modal-info-section p {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-icon {
    flex-shrink: 0;
    color: var(--color-success-dark);
    stroke-width: 2.5;
}

.modal-footer-section {
    background: var(--color-bg-secondary);
    padding: 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--color-primary);
    box-sizing: border-box;
}

.modal-footer-section p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Responsive modal on smaller screens */
@media (max-width: 768px) {
    .welcome-modal {
        padding: 10px;
    }

    .welcome-modal-content {
        width: 100%;
        height: 90vh;
        max-height: none;
        border-radius: 12px;
        margin: 0 auto;
    }

    .modal-header {
        padding: 35px 15px 20px;
    }

    .modal-header h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .modal-subtitle {
        font-size: 0.9rem;
    }

    .modal-body {
        padding: 20px 15px;
    }

    .modal-section {
        margin-bottom: 25px;
    }

    .modal-section h3 {
        font-size: 1.05rem;
        margin-bottom: 12px;
    }

    .modal-section h3 .section-icon {
        width: 18px;
        height: 18px;
    }

    .inline-icon {
        width: 16px;
        height: 16px;
    }

    .modal-section p,
    .modal-section li {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .modal-section ol,
    .modal-section ul {
        padding-left: 20px;
    }

    .modal-close-btn {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .modal-footer-section {
        padding: 15px;
    }

    /* Tutorial Steps Responsive */
    .tutorial-step {
        margin-bottom: 25px;
        padding-bottom: 20px;
    }

    .tutorial-step h4 {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .tutorial-step p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .tutorial-image {
        margin-top: 12px;
    }

    .tutorial-image img {
        max-height: 300px;
    }

    .modal-info-section {
        padding: 12px 15px;
    }

    .modal-info-section p {
        font-size: 0.9rem;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .welcome-modal {
        padding: 5px;
    }

    .welcome-modal-content {
        border-radius: 8px;
    }

    .modal-header {
        padding: 30px 12px 18px;
    }

    .modal-header h2 {
        font-size: 1.3rem;
    }

    .modal-subtitle {
        font-size: 0.85rem;
    }

    .modal-body {
        padding: 15px 12px;
    }

    .modal-section h3 {
        font-size: 1rem;
    }

    .modal-section h3 .section-icon {
        width: 16px;
        height: 16px;
    }

    .inline-icon {
        width: 14px;
        height: 14px;
    }

    .modal-section p,
    .modal-section li {
        font-size: 0.85rem;
    }

    .modal-close-btn {
        top: 12px;
        right: 12px;
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    /* Tutorial Steps Extra Small Responsive */
    .tutorial-step {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .tutorial-step h4 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .tutorial-step p {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .tutorial-image {
        margin-top: 10px;
    }

    .tutorial-image img {
        max-height: 250px;
    }

    .modal-info-section {
        padding: 10px 12px;
    }

    .modal-info-section p {
        font-size: 0.85rem;
    }
}

/* Responsive adjustment */
@media (max-width: 900px) {
    /* Remove side padding on mobile for full-width layout */
    body > *:not(.navbar) {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    body > .main-grid {
        padding-top: 12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .main-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Card adjustments for mobile */
    .card {
        padding: 16px;
    }
    
    #upload-box {
        flex-direction: column;
        gap: 15px;
    }
    
    /* Fix preview box and images for mobile */
    .preview-box {
        min-height: 180px;
        max-height: 250px;
        height: auto;
        width: 100%;
        box-sizing: border-box;
    }
    
    .preview-box img {
        object-fit: contain;
        max-height: 250px;
        width: 100%;
        height: auto;
    }
    
    /* Form elements on mobile */
    .input-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .file-label,
    .icon-btn {
        width: 100%;
        padding: 10px 16px;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn,
    .btn-new {
        width: 100%;
    }
    
    /* Fix result box images for mobile */
    .viz-container {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .viz-box {
        width: 100%;
        max-height: 300px;
        aspect-ratio: auto;
        box-sizing: border-box;
    }
    
    .viz-box img {
        max-height: 300px;
        object-fit: contain;
        width: 100%;
    }
    
    /* Gemini box for mobile */
    #gemini-box {
        max-height: none;
        min-height: 300px;
    }
    
    .gemini-content {
        height: 400px; /* Fixed height on mobile */
        min-height: 400px;
        max-height: 400px; /* Fixed - won't grow taller */
        font-size: 0.9rem;
    }
    
    /* Fix camera modal for mobile */
    .camera-modal {
        padding: 10px;
    }
    
    .camera-container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        justify-content: center;
        box-sizing: border-box;
    }
    
    #cameraVideo {
        width: 100%;
        max-width: 100%;
        max-height: 55vh;
        height: auto;
        object-fit: cover;
        border-radius: var(--radius-sm);
        box-sizing: border-box;
    }
    
    .camera-controls {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 10px;
        padding: 0 10px;
        box-sizing: border-box;
    }
    
    .camera-btn {
        flex: 1;
        min-width: 90px;
        max-width: 140px;
        padding: 10px 15px;
        font-size: 0.9rem;
        box-sizing: border-box;
    }
    
    /* Navbar adjustments */
    .navbar {
        padding: 12px;
        position: relative;
    }
    
    .navbar-logo img {
        height: 40px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    .navbar-links {
        gap: 10px;
    }
    
    /* Hide desktop nav menu on mobile */
    .nav-menu {
        display: none !important;
    }
    
    /* Show hamburger menu on mobile */
    .hamburger-menu {
        display: flex !important;
    }
    
    .nav-link {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
}

/* Extra small screens (phones in portrait - 480px and below) */
@media (max-width: 480px) {
    body > *:not(.navbar) {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    body > .main-grid {
        padding: 8px;
    }
    
    .card {
        padding: 12px;
        border-radius: var(--radius-sm);
    }
    
    #upload-box {
        gap: 12px;
    }
    
    .preview-box {
        min-height: 150px;
        max-height: 200px;
    }
    
    .preview-box img {
        max-height: 200px;
    }
    
    .file-label,
    .icon-btn,
    .btn,
    .btn-new {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .navbar {
        padding: 8px;
    }
    
    .navbar-logo img {
        height: 35px;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
    }
    
    #cameraVideo {
        max-height: 50vh;
    }
    
    .camera-btn {
        min-width: 80px;
        max-width: 120px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .gemini-content {
        height: 350px; /* Fixed height on extra small screens */
        min-height: 350px;
        max-height: 350px; /* Fixed - won't grow taller */
        font-size: 0.85rem;
        padding: 12px;
    }
}

/* Disable page-level scrolling on desktop/PC view while keeping internal
       containers scrollable. This preserves the current visual layout but
       prevents the entire page from scrolling on wide screens. Mobile/tablet
       devices (<=900px) will keep normal page scrolling. */
@media (min-width: 901px) {
    html,
    body {
        height: 100%;
        overflow: hidden; /* Prevent page scroll completely */
    }
}

/* Scrollable container for about page - Landscape layout */
.scrollable-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 82px); /* Full viewport - navbar */
    padding: 40px 20px 50px 20px; /* Top/bottom padding for centering + 50px gap */
    overflow: hidden; /* Prevent page scroll */
    box-sizing: border-box;
}

.scrollable-container .card {
    width: 85vw; /* Landscape width - spans most of the screen horizontally */
    max-width: 1400px; /* Maximum width limit */
    height: auto; /* Auto height */
    max-height: calc(100vh - 82px - 90px); /* Responsive: viewport - navbar - top padding (40px) - bottom gap (50px) */
    overflow-y: auto; /* Scrollable content */
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Custom scrollbar for scrollable container card */
.scrollable-container .card::-webkit-scrollbar {
    width: 10px;
}
.scrollable-container .card::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
.scrollable-container .card::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
    border: 2px solid var(--color-bg-card);
}
.scrollable-container .card::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* About Page Sections */
.about-section {
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--color-border);
}

.about-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.about-section h3 {
    color: var(--color-success-dark);
    font-size: 1.4rem;
    margin: 0 0 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.about-section h3 .section-icon {
    flex-shrink: 0;
    color: var(--color-primary);
    stroke-width: 2.5;
}

.about-section p {
    color: var(--color-text-primary);
    line-height: 1.8;
    margin: 10px 0;
    font-size: 1rem;
}

.about-section ul {
    color: var(--color-text-primary);
    line-height: 2;
    margin: 10px 0;
    padding-left: 25px;
}

.about-section li {
    margin: 8px 0;
    font-size: 1rem;
}

.about-section li strong {
    color: var(--color-warning-dark);
    font-weight: 700;
}

/* Info Highlight Section */
.info-highlight {
    background: var(--color-bg-tertiary);
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--color-success-dark);
    border-bottom: none;
}

.info-highlight p {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Note Section */
.note-section {
    background: var(--color-bg-secondary);
    padding: 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--color-primary);
    border-bottom: none;
}

.note-section p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

/* ==================== CONTACT PAGE STYLES ==================== */

/* Contact Container - No Scroll Layout */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    height: calc(100vh - 82px); /* Full viewport - navbar */
    padding: 40px 25px 50px 25px; /* Top/bottom padding for centering + 50px gap */
    overflow: hidden;
    box-sizing: border-box;
}

@media (max-width: 1400px) {
    .contact-container {
        padding: 30px 20px 40px 20px;
        gap: 20px;
    }
}

@media (max-width: 1200px) {
    .contact-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
        padding: 20px 15px;
    }
}

/* Left Section - Developers */
.contact-left {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
}

.developers-card {
    height: 100%;
    max-height: 100%; /* Use available space */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 25px;
}

@media (max-width: 1400px) {
    .developers-card {
        padding: 20px;
        gap: 20px;
    }
}

/* Final Developers Grid - Single Column Vertical Layout */
.developers-grid-final {
    display: flex;
    flex-direction: column;
    gap: 35px;
    margin: 0;
    padding: 0;
}

.dev-item-final {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.dev-photo-final {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dev-photo-final img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.dev-info-final {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.dev-info-final p {
    margin: 0;
    font-size: 1.05rem;
    color: var(--color-text-primary);
    line-height: 1.7;
}

.dev-info-final strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Team Card Layout - Developers & Advisors */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--color-text-primary);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
}

.team-card {
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.team-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.team-photo {
    width: 100%;
    height: 250px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-info p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    line-height: 1.6;
    word-break: break-word;
}

.team-info strong {
    font-weight: 600;
    color: var(--color-text-secondary);
}

.github-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

.github-link:hover {
    color: var(--color-primary-hover);
    transform: translateX(3px);
}

.github-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

.github-link:hover::after {
    width: 100%;
}

/* Right Section */
.contact-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
}

/* Project Info Card */
.project-info-card {
    flex-shrink: 0;
    overflow: visible;
}

.project-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.project-logo {
    width: 145px;
    height: 145px;
}

.project-brief p {
    color: var(--color-text-primary);
    line-height: 1.7;
    font-size: 0.95rem;
    margin: 0 0 15px;
    text-align: justify;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--color-primary-light);
    color: var(--color-text-primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--color-primary);
}

/* Contact Form Card */
.contact-form-card {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: 100%; /* Use available space */
    padding: 25px;
}

@media (max-width: 1400px) {
    .contact-form-card {
        padding: 20px;
    }
}

.contact-form-card h3 {
    color: var(--color-success-dark);
    font-size: 1.2rem;
    margin: 0 0 20px;
    font-weight: 700;
}

.contact-form-compact {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 1200px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-compact label {
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group-compact input,
.form-group-compact textarea {
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-input);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group-compact input:focus,
.form-group-compact textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-bg-main);
}

.form-group-compact textarea {
    resize: vertical;
    min-height: 80px;
}

.btn-submit {
    padding: 12px 24px;
    background: var(--color-primary);
    color: var(--color-text-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

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

.btn-submit:active {
    transform: translateY(0);
}

.success-message {
    padding: 12px 16px;
    background: var(--color-success);
    color: var(--color-text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
}

/* Custom Scrollbar for Contact Cards */
.developers-card::-webkit-scrollbar,
.contact-form-card::-webkit-scrollbar {
    width: 8px;
}

.developers-card::-webkit-scrollbar-track,
.contact-form-card::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

.developers-card::-webkit-scrollbar-thumb,
.contact-form-card::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
    border: 2px solid var(--color-bg-card);
}

.developers-card::-webkit-scrollbar-thumb:hover,
.contact-form-card::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Responsive Contact Page */
@media (max-width: 900px) {
    .contact-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
        padding: 15px;
    }

    .contact-left,
    .contact-right {
        overflow: visible;
    }

    .developers-card,
    .contact-form-card {
        overflow: visible;
        height: auto;
    }

    /* Team card grid - stack on mobile */
    .team-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .team-card {
        padding: 15px;
    }

    .team-photo {
        height: 200px;
    }

    .team-info p {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    .dev-item-final {
        gap: 18px;
    }

    .dev-photo-final {
        width: 120px;
        height: 120px;
    }

    .dev-info-final p {
        font-size: 0.95rem;
    }
    
    .dev-info-final {
        gap: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .project-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .project-logo {
        width: 80px;
        height: 80px;
    }
}
