/* ==========================================
   RESPONSIVE ENHANCEMENTS - All Pages
   Full Balanced Responsive Design System
   ========================================== */

/* ===== GLOBAL RESPONSIVE FIXES ===== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== CONTAINER IMPROVEMENTS ===== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 768px) {
    .container {
        padding: 0 40px;
    }
}

@media (min-width: 1200px) {
    .container {
        padding: 0 60px;
    }
}

/* ===== HEADER RESPONSIVE ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Global Menu Overlay Styling */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 3000 !important;
}

.menu-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Ensure Nav is above overlay when active */
header nav.active {
    z-index: 3100 !important;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo img {
    height: 45px;
    width: auto;
}

.logo span {
    font-size: 1.4rem;
    font-weight: 800;
}

/* Mobile Menu Toggle - Force Visibility & Modern Styling */
.mobile-menu-toggle {
    display: none;
    width: 46px !important;
    height: 46px !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    background: var(--gradient-primary) !important;
    border: none !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    padding: 10px !important;
    z-index: 5000 !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3) !important;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    margin-left: 15px !important;
}

.mobile-menu-toggle:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4) !important;
}

.mobile-menu-toggle:active {
    transform: scale(0.9) !important;
}

.mobile-menu-toggle span {
    display: block !important;
    width: 24px !important;
    height: 3px !important;
    background: #ffffff !important;
    border-radius: 3px !important;
    margin: 3px 0 !important;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
    position: relative !important;
}

/* Toggle Active State Spans */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg) !important;
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0 !important;
    transform: scaleX(0) !important;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg) !important;
}

/* Desktop Navigation */
header nav ul {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

header nav ul li a {
    padding: 12px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #475569;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

header nav ul li a:hover,
header nav ul li a.active {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

.login-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3) !important;
}

.login-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4) !important;
}

/* ===== TABLET RESPONSIVE (768px - 1024px) ===== */
@media (max-width: 1200px) {
    header nav ul {
        gap: 4px;
    }

    header nav ul li a {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .login-btn {
        padding: 10px 18px !important;
    }
}

/* ===== MOBILE RESPONSIVE (< 768px) ===== */
/* ===== MOBILE RESPONSIVE PRE-SETS (Handled primarily by animations.css) ===== */
@media (max-width: 992px) {
    header {
        background: #ffffff !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-height: 70px !important;
        z-index: 4000 !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    header .header-content {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 15px !important;
        width: 100% !important;
    }

    /* Mobile Menu Overlay */
    header nav {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100vh !important;
        background: #ffffff !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        padding: 100px 25px 40px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
        z-index: 5000 !important;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1) !important;
        overflow-y: auto !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    header nav.active {
        right: 0 !important;
    }

    header nav ul {
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100% !important;
        gap: 5px !important;
    }

    header nav ul li {
        width: 100% !important;
        margin: 0 !important;
    }

    header nav ul li a {
        display: flex !important;
        padding: 14px 20px !important;
        width: 100% !important;
        color: #1e293b !important;
        font-size: 1.05rem !important;
        border-radius: 12px !important;
        background: transparent !important;
        transition: all 0.3s ease !important;
        text-align: left !important;
        justify-content: flex-start !important;
        border: 1px solid transparent !important;
    }

    header nav ul li a:hover,
    header nav ul li a.active {
        color: #4361ee !important;
        background: rgba(67, 97, 238, 0.08) !important;
        border-color: rgba(67, 97, 238, 0.1) !important;
    }

    /* Mobile Integrated User Menu Styling */
    .mobile-user-item {
        width: 100% !important;
        margin-top: 20px !important;
        padding-top: 20px !important;
        border-top: 1px solid #f1f5f9 !important;
    }

    .mobile-user-item .user-info {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 15px 20px !important;
        background: #f8fafc !important;
        border-radius: 16px !important;
        width: 100% !important;
        border: 1px solid #e2e8f0 !important;
    }

    .mobile-user-item .user-info span {
        font-weight: 700 !important;
        color: #1e293b !important;
        font-size: 1rem !important;
    }

    /* Prevent mobile scroll when menu open */
    body.menu-open {
        overflow: hidden !important;
    }

    /* Staggered items reveal */
    header nav ul li {
        opacity: 0;
        transform: translateX(20px);
        transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    }

    header nav.active ul li {
        opacity: 1;
        transform: translateX(0);
    }

    header nav.active ul li:nth-child(1) {
        transition-delay: 0.1s;
    }

    header nav.active ul li:nth-child(2) {
        transition-delay: 0.2s;
    }

    header nav.active ul li:nth-child(3) {
        transition-delay: 0.3s;
    }

    header nav.active ul li:nth-child(4) {
        transition-delay: 0.4s;
    }

    header nav.active ul li:nth-child(5) {
        transition-delay: 0.5s;
    }

    header nav.active ul li:nth-child(6) {
        transition-delay: 0.6s;
    }
}

/* ===== HERO SECTIONS RESPONSIVE ===== */
.hero,
.services-hero,
.blog-hero-premium,
.work-hero,
.contact-hero,
.request-hero {
    padding-top: 120px !important;
}

@media (max-width: 768px) {

    .hero,
    .services-hero,
    .blog-hero-premium,
    .work-hero,
    .contact-hero,
    .request-hero {
        padding-top: 100px !important;
        padding-bottom: 60px !important;
    }
}

@media (max-width: 480px) {

    .hero,
    .services-hero,
    .blog-hero-premium,
    .work-hero,
    .contact-hero,
    .request-hero {
        padding-top: 90px !important;
        padding-bottom: 50px !important;
    }
}

/* ===== SERVICES GRID RESPONSIVE ===== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* ===== BLOG GRID RESPONSIVE ===== */
.blog-grid-premium {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 35px;
}

@media (max-width: 768px) {
    .blog-grid-premium {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 0 15px;
    }
}

/* Blog Card Responsive */
.blog-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
    transition: all 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.blog-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12);
}

.blog-card-image {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #f1f5f9;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.1);
}

.blog-card-content {
    padding: 30px;
}

@media (max-width: 480px) {
    .blog-card-content {
        padding: 20px;
    }
}

.blog-card-header {
    margin-bottom: 15px;
}

.blog-card-date {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.blog-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .blog-card-title {
        font-size: 1.15rem;
    }
}

.blog-card-excerpt {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

.blog-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.blog-card-stats {
    color: #94a3b8;
    font-size: 0.85rem;
}

.blog-card-read-more {
    color: #6366f1;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card-read-more:hover {
    color: #4f46e5;
    gap: 12px;
}

/* ===== WORK GRID RESPONSIVE ===== */
.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 40px;
}

@media (max-width: 768px) {
    .work-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ===== CONTACT GRID RESPONSIVE ===== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 60px;
    align-items: start;
}

@media (max-width: 992px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

/* ===== UPDATES GRID RESPONSIVE ===== */
.updates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

@media (max-width: 768px) {
    .updates-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

/* ===== FEATURES GRID RESPONSIVE ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 35px;
}

@media (max-width: 1200px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

/* ===== FORM RESPONSIVE ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

input,
select,
textarea {
    width: 100%;
    font-size: 16px;
    /* Prevents iOS zoom */
}

/* ===== FOOTER RESPONSIVE ===== */
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    padding: 60px 0 40px;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
        padding: 40px 0 30px;
    }

    .footer-section ul {
        padding: 0;
    }
}

.footer-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 12px;
}

.footer-section ul li a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.5s ease;
}

.footer-section ul li a:hover {
    color: #22c55e;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 25px 0;
    text-align: center;
}

.footer-bottom p {
    color: #64748b;
    font-size: 0.9rem;
}

/* ===== BUTTONS RESPONSIVE ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
}

@media (max-width: 480px) {
    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .cta-buttons {
        flex-direction: column;
        width: 100%;
    }

    .cta-buttons .btn {
        width: 100%;
    }
}

/* ===== CATEGORY NAV RESPONSIVE ===== */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 25px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .category-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 20px 15px;
    }

    .category-btn {
        justify-content: center;
        text-align: center;
    }
}

/* ===== USER DASHBOARD RESPONSIVE ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

@media (max-width: 480px) {
    .actions-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ===== ADMIN DASHBOARD RESPONSIVE ===== */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== MODAL RESPONSIVE ===== */
.modal-content {
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

@media (max-width: 768px) {
    .modal-content {
        margin: 10px;
        padding: 25px 20px;
    }
}

/* ===== LIGHTBOX RESPONSIVE ===== */
.lightbox-modal {
    padding: 20px;
}

@media (max-width: 768px) {
    .lightbox-modal {
        padding: 15px;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 50%;
        font-size: 1.5rem;
    }

    .lightbox-info {
        padding: 15px 0;
    }

    .lightbox-info h3 {
        font-size: 1.2rem;
    }
}

/* ===== FILTER BUTTONS RESPONSIVE ===== */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 50px;
}

@media (max-width: 768px) {
    .filter-container {
        gap: 10px;
        margin-bottom: 30px;
    }

    .filter-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}

/* ===== SCROLL ANIMATIONS ===== */
.animate-up {
    opacity: 0;
    transform: translateY(30px);
    animation: animateUp 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes animateUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll reveal animation */
.scroll-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== SAFE AREA INSETS FOR NOTCHED DEVICES ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    header {
        padding-top: env(safe-area-inset-top);
    }

    .footer-bottom {
        padding-bottom: calc(25px + env(safe-area-inset-bottom));
    }
}

/* ===== PRINT STYLES ===== */
@media print {

    header,
    footer,
    .mobile-menu-toggle,
    .back-to-top,
    .floating-admin-panel {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}