/* --- MODERN DASHBOARD DESIGN SYSTEM --- */
:root {
    /* Brand Colors (Indigo) */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: rgba(79, 70, 229, 0.08);

    /* Neutral / UI Colors (Slate) */
    --bg-body: #f8fafc;
    /* Slate 50 */
    --bg-surface: #ffffff;
    /* White */
    --bg-surface-alt: #f1f5f9;
    /* Slate 100 */

    --text-main: #0f172a;
    /* Slate 900 */
    --text-body: #334155;
    /* Slate 700 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border-color: #e2e8f0;
    /* Slate 200 */
    --border-focus: #cbd5e1;
    /* Slate 300 */

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-primary: 0 4px 14px 0 rgba(79, 70, 229, 0.25);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    --transition-base: all 0.2s ease-in-out;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Glass Effect Vars */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(226, 232, 240, 0.8);
}

/* Dark Mode Support (Manual Toggle) */
[data-theme="dark"] {
    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-surface: #1e293b;
    /* Slate 800 */
    --bg-surface-alt: #334155;
    /* Slate 700 */

    --text-main: #f8fafc;
    /* Slate 50 */
    --text-body: #e2e8f0;
    /* Slate 200 - Brighter for contrast */
    --text-muted: #cbd5e1;
    /* Slate 300 - Brighter for contrast */

    --border-color: #334155;
    /* Slate 700 */
    --border-focus: #475569;
    /* Slate 600 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);

    /* Glass Effect Vars Dark */
    --glass-bg: rgba(30, 41, 59, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* Manual override for alerts in dark mode */
[data-theme="dark"] .alert-success {
    background-color: rgba(22, 101, 52, 0.2);
    color: #86efac;
    border: 1px solid #14532d;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(153, 27, 27, 0.2);
    color: #fca5a5;
    border: 1px solid #7f1d1d;
}

/* --- BASE & TYPOGRAPHY --- */
body {
    background-color: var(--bg-body);
    color: var(--text-body);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Override Bootstrap text-muted to use our variable */
.text-muted {
    color: var(--text-muted) !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
    font-family: var(--font-heading);
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition-base);
}

a:hover {
    color: var(--primary-hover);
}

/* --- LAYOUT UTILITIES --- */
.container {
    max-width: 1280px;
    padding: 0 1.5rem;
}

section {
    position: relative;
    z-index: 1;
}

section:not(#contact)::after {
    content: "";
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 1280px;
    /* Matches container width */
    height: 1px;
    background-color: var(--border-color);
}

/* --- COMPONENT: NAVBAR --- */
.navbar {
    padding: 0.8rem 0;

    /* Glass Effect */
    background-color: var(--glass-bg);
    border-bottom: 1px solid transparent;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: none;

    transition: background-color 0.3s ease, border-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
    padding: 0.5rem 0;
    border-bottom-color: var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted) !important;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background-color: var(--primary-soft);
}

/* --- COMPONENT: HERO --- */
.hero-section {
    padding: 8rem 0 4rem;
    background: radial-gradient(circle at top right, var(--primary-soft), transparent 40%);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

/* --- COMPONENT: BUTTONS --- */
.btn {
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    border: none;
}

.btn-primary-custom {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-primary);
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* --- COMPONENT: CARDS & PROJECTS --- */
.card-project {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 100%;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card-project:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-focus);
}

.card-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background-color: var(--bg-surface-alt);
    border-bottom: 1px solid var(--border-color);
}

.card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.card-project:hover .card-img-top {
    transform: scale(1.05);
}

.card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.125rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.tech-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background-color: var(--primary-soft);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    margin-right: 0.4rem;
    margin-bottom: 0.4rem;
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.925rem;
    line-height: 1.5;
    margin: 0.75rem 0 1.5rem;
    flex-grow: 1;

    /* Truncate text */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-project {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    color: var(--text-body);
    background: transparent;
    font-size: 0.9rem;
}

.btn-project:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--bg-surface);
}

/* --- COMPONENT: FILTERS --- */
.filter-toolbar {
    background-color: #4f46e5;
    /* Primary Indigo */
    border: none;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 3rem;
    position: sticky;
    top: 90px;
    z-index: 10;
    transition: box-shadow 0.3s ease;
}

.filter-toolbar:focus-within {
    box-shadow: var(--shadow-lg);
}

.form-control-custom,
.form-select-custom {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    width: 100%;
}

.form-control-custom:focus,
.form-select-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    outline: none;
    color: var(--text-main);
    background-color: var(--bg-surface);
}

.filter-tag {
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-weight: 500;
}

.filter-tag:hover,
.filter-tag.active {
    background-color: var(--text-main);
    color: var(--bg-surface);
    border-color: var(--text-main);
}

/* --- COMPONENT: FORMS --- */
.form-floating>.form-control {
    background-color: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.form-floating>.form-control:focus {
    background-color: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-floating>label {
    color: var(--text-muted);
}

/* --- COMPONENT: FOOTER --- */
footer {
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    margin-top: 6rem;
    background-color: var(--bg-body);
    position: relative;
    text-align: center;
}

/* --- UTILITIES --- */
.no-results {
    padding: 4rem 1rem;
    text-align: center;
}

/* Alert Styles Override */
.alert {
    border-radius: var(--radius-md);
    border: none;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}



/* --- RESPONSIVE FIXES --- */
@media (max-width: 768px) {
    .filter-toolbar {
        position: relative;
        top: 0;
        padding: 1rem;
    }

    .hero-section {
        padding: 6rem 0 3rem;
        text-align: center;
    }

    .hero-section .d-flex {
        justify-content: center;
    }
}

/* --- INPUT GROUP FOCUS FIX --- */
.input-group:focus-within {
    box-shadow: 0 0 0 3px var(--primary-soft);
    border-radius: var(--radius-md);
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--bg-surface) !important;
}

.input-group:focus-within .form-control-custom {
    border-color: var(--primary);
    box-shadow: none !important;
}

/* CSS for Rotating Chevron on Collapse */
.btn[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.transition-icon {
    transition: transform 0.3s ease;
}