:root {
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --bg-primary: #0b0f19;
    --bg-card: rgba(22, 30, 46, 0.75);
    --border-card: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-gradient-start: #6366f1;
    --color-gradient-end: #a855f7;
}

[data-bs-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.9);
    --border-card: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

html, body {
    max-width: 100vw;
    overflow-x: hidden !important;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--bs-body-color);
    transition: background-color 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fluid Typography */
h1, .display-4 {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 5vw, 2.75rem) !important;
    line-height: 1.2 !important;
}

h2, .display-5 {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 4.2vw, 2.25rem) !important;
    line-height: 1.25 !important;
}

h3, .display-6 {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 3.5vw, 1.75rem) !important;
}

h4, h5, h6, .brand-text {
    font-family: var(--font-heading);
}

p, span, div, h1, h2, h3, h4, h5, h6, td, th {
    overflow-wrap: break-word;
}

/* Glassmorphism Classes */
.glass-nav {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-card) !important;
}

.glass-nav .nav-link {
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
}

.glass-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff !important;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-card);
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
}

.glass-dropdown {
    background: var(--bg-card) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
}

.glass-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    color: var(--bs-body-color);
    min-height: 46px;
    font-size: 1rem; /* Prevents auto-zoom on iOS Safari */
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

/* Touch-friendly buttons and inputs */
.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.btn-sm {
    min-height: 36px;
}

/* Gradients & Animations */
.text-gradient {
    background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.shadow-primary {
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

.card-hover {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px 0 rgba(0, 0, 0, 0.4);
}

/* Dropzone */
.border-dashed {
    border: 2px dashed var(--border-card);
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}
.border-dashed.dragover, .border-dashed:hover {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.05) 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: 6px;
    display: inline-block;
}

@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Toast Container */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    width: 100%;
}

.custom-toast {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    color: #fff;
    padding: 0.85rem 1.15rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Editor Styling */
.editor-textarea {
    font-family: var(--font-mono);
    line-height: 1.7;
    border-radius: 0.75rem;
    resize: vertical;
}

/* Custom Scrollbars & Responsive Tables */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.75rem;
}

/* Navigation & Header */
.glass-nav .nav-link {
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    gap: 0.4rem !important;
}

.glass-nav .nav-link i.bi {
    font-size: 1.05rem !important;
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.glass-nav .btn {
    white-space: nowrap !important;
}

/* Sticky Action Bar */
.sticky-actions {
    position: sticky;
    top: 70px;
    z-index: 1020;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-card);
    margin-bottom: 1.5rem;
}

/* =========================================================================
   RESPONSIVE MOBILE & TABLET MEDIA QUERIES
   ========================================================================= */

/* Mobile & Tablet Navigation Menu (< 992px) */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(11, 15, 25, 0.97) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid var(--border-card) !important;
        border-radius: 1rem !important;
        padding: 1.25rem !important;
        margin-top: 0.75rem !important;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6) !important;
    }

    .navbar-nav {
        gap: 0.25rem !important;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        font-size: 1.05rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        justify-content: flex-start;
    }

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

    .navbar-toggler {
        padding: 0.5rem 0.75rem;
        border-radius: 0.5rem;
    }

    .brand-text .text-gradient {
        max-width: clamp(140px, 35vw, 220px) !important;
    }

    .glass-nav .btn {
        width: 100%;
        margin-top: 0.75rem;
        padding: 0.75rem 1rem;
    }
}

/* Small Screens & Mobile Phones (< 768px) */
@media (max-width: 767.98px) {
    .dropzone-area {
        padding: 1.5rem 1rem !important;
    }

    .dropzone-icon i {
        font-size: 2.25rem !important;
    }

    .sticky-actions {
        top: 60px !important;
        padding: 0.5rem 0.75rem !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sticky-actions .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }

    .editor-textarea {
        font-size: 0.875rem !important;
        padding: 0.75rem !important;
    }

    .hero-section {
        padding-top: 1rem !important;
        padding-bottom: 1.5rem !important;
    }

    .footer {
        text-align: center;
    }

    .footer .list-inline {
        justify-content: center !important;
    }
}

/* Extra Small Phones (< 576px) */
@media (max-width: 575.98px) {
    #toast-container {
        right: 0.75rem !important;
        left: 0.75rem !important;
        max-width: calc(100vw - 1.5rem) !important;
        top: 1rem !important;
    }

    .card-body {
        padding: 1.15rem !important;
    }

    .badge {
        font-size: 0.7rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        border-radius: 0.5rem !important;
        margin-bottom: 0.35rem;
    }
}

/* ===== Blog Image — Actual Ratio Preserve ===== */

/* Listing page: card thumbnail — actual ratio, no crop */
.blog-img-wrap {
    display: block;
    width: 100%;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.blog-card-img {
    display: block;
    width: 100%;
    height: auto;           /* actual image height — ratio preserved */
    object-fit: contain;    /* no crop, no stretch */
    max-height: 340px;      /* bahut lambi images ko limit karo */
    transition: transform 0.35s ease, opacity 0.3s ease;
}

.hover-lift:hover .blog-card-img {
    transform: scale(1.03);
    opacity: 0.92;
}

/* Detail page: full-width featured image — actual ratio */
.blog-featured-img-wrap {
    width: 100%;
    background: rgba(0, 0, 0, 0.12);
}

.blog-featured-img {
    display: block;
    width: 100%;
    height: auto;           /* actual image height — ratio preserved */
    object-fit: contain;    /* no crop, no stretch */
    max-height: 600px;      /* bahut lambi images ko limit karo */
}
