/* Global Design System & Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Light Mode Variables */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.85);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --secondary: #6d28d9;
    --accent: #7c3aed;

    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 20px 40px -15px rgba(79, 70, 229, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);

    /* Keep Bootstrap's own primary utilities (btn-primary, text-primary,
       bg-primary-subtle, links, ...) in sync with the theme above */
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-primary-bg-subtle: #e0e7ff;
    --bs-primary-border-subtle: #c7d2fe;
    --bs-primary-text-emphasis: #4338ca;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #4338ca;
    --bs-link-hover-color-rgb: 67, 56, 202;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-body: #0b0f19;
    --bg-card: #151c2c;
    --bg-header: rgba(15, 23, 42, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #2a364f;
    
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-light: rgba(99, 102, 241, 0.2);
    --secondary: #8b5cf6;

    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    --card-shadow-hover: 0 20px 40px -15px rgba(99, 102, 241, 0.3);
    --glass-bg: rgba(21, 28, 44, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);

    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-primary-bg-subtle: #2e2a5c;
    --bs-primary-border-subtle: #4338ca;
    --bs-primary-text-emphasis: #a5b4fc;
    --bs-link-color: #818cf8;
    --bs-link-color-rgb: 129, 140, 248;
    --bs-link-hover-color: #a5b4fc;
    --bs-link-hover-color-rgb: 165, 180, 252;
}

/* Bootstrap ships literal colors baked into some components (buttons,
   subtle badges) instead of reading --bs-primary at the usage site, so the
   root variable override above doesn't reach them. Override those directly
   so every "primary" surface matches the theme. */
.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

.text-primary { color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }
.bg-primary-subtle { background-color: var(--primary-light) !important; }
.text-bg-primary { background-color: var(--primary) !important; color: #ffffff !important; }

/* Bootstrap Dark Mode Overrides for High Contrast */
[data-theme="dark"] .text-dark {
    color: #f8fafc !important;
}

[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-secondary {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .text-body {
    color: #f8fafc !important;
}

[data-theme="dark"] .bg-body {
    background-color: #151c2c !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .card-custom {
    border-color: #2a364f !important;
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-body);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Glassmorphism Header Navbar */
.navbar-custom {
    background-color: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary) !important;
    padding: 0.5rem 1rem !important;
    transition: all 0.2s ease;
}

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

/* Theme Toggle Button */
.btn-theme-toggle {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-theme-toggle:hover {
    transform: rotate(20deg) scale(1.1);
}

/* Hero Section */
.hero-section {
    position: relative;
    padding: 6rem 0 4rem;
    background: radial-gradient(circle at 10% 20%, var(--primary-light) 0%, transparent 40%);
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
}

/* Custom Buttons */
.btn-primary-custom {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 50rem;
    border: none;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-outline-custom {
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 50rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline-custom:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* Cards Design System */
.card-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.service-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

/* Portfolio Cards */
.portfolio-card {
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.portfolio-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow-hover);
}

.portfolio-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 60%;
    overflow: hidden;
}

.portfolio-img-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portfolio-card:hover .portfolio-img-wrapper img {
    transform: scale(1.06);
}

.portfolio-body {
    padding: 1.5rem;
}

.badge-tech {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 50rem;
    display: inline-block;
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
}

/* Filter Pills */
.filter-pill {
    padding: 0.5rem 1.25rem;
    border-radius: 50rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill:hover, .filter-pill.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Footer */
footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 4rem 0 2rem;
    margin-top: 6rem;
}

/* Preloader & Scroll to Top */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--primary-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#scrollTopBtn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 990;
}

#scrollTopBtn.show {
    opacity: 1;
    visibility: visible;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 90vw;
}

.custom-toast {
    background: var(--bg-card);
    color: var(--text-primary);
    border-left: 4px solid var(--primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 260px;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Media Queries for All Screen Sizes */
@media (max-width: 991.98px) {
    .hero-section {
        padding: 4rem 0 3rem;
    }
    .hero-title {
        font-size: 2.4rem;
    }
}

@media (max-width: 767.98px) {
    .hero-title {
        font-size: 1.9rem;
    }
    .hero-desc {
        font-size: 1.05rem;
    }
    .navbar-brand {
        font-size: 1.25rem;
    }
    .card-custom {
        padding: 1.25rem;
    }
    footer {
        padding: 3rem 0 1.5rem;
        margin-top: 3rem;
    }
    .btn-primary-custom, .btn-outline-custom {
        padding: 0.6rem 1.4rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 1.65rem;
    }
    .service-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
