/**
 * Enhanced Responsive Design System - Complete Mobile & Desktop Support
 * Fixes all screen sizes from 320px to 4K displays
 */

/* ===================================
   CRITICAL: Base Reset & Foundation
   =================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

img,
video,
iframe,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===================================
   Responsive Container System
   =================================== */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Mobile First - Extra Small (320px - 575px) */
@media (min-width: 320px) {
    .container {
        max-width: 100%;
        padding: 0 1rem;
    }
}

/* Small devices (576px - 767px) */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
        padding: 0 1.5rem;
    }
}

/* Tablets (768px - 991px) */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
        padding: 0 2rem;
    }
}

/* Small laptops (992px - 1199px) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

/* Desktops (1200px - 1399px) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Large Desktops (1400px+) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Ultra-wide (1920px+) */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
}

/* ===================================
   Mobile First: 320px - 575px
   =================================== */
@media (max-width: 575px) {
    /* Typography */
    body {
        font-size: 14px;
        line-height: 1.6;
    }

    h1, .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    h2, .section-title {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    h4 {
        font-size: 1.1rem !important;
    }

    p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    /* Navigation Bar */
    .navbar {
        position: sticky;
        top: 0;
        width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 0.75rem 1rem;
        z-index: 1000;
    }

    .nav-container {
        width: 100%;
        padding: 0;
    }

    .nav-logo {
        gap: 0.5rem;
        font-size: 1rem;
    }

    .logo-img {
        width: 36px !important;
        height: 36px !important;
    }

    .logo-text {
        font-size: 1rem;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 32px;
        height: 24px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }

    .mobile-menu-btn span {
        display: block;
        width: 100%;
        height: 3px;
        background: currentColor;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translateY(10px);
    }

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

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translateY(-10px);
    }

    /* Hero Section */
    .hero-section {
        min-height: auto;
        padding: 80px 0 2rem;
    }

    .hero-section .container {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-content {
        text-align: center;
        padding: 0;
    }

    .hero-badge {
        margin: 0 auto 1rem;
        padding: 0.5rem 1rem;
        max-width: 100%;
        font-size: 0.75rem;
    }

    .badge-text {
        font-size: 0.7rem;
        white-space: normal;
        text-align: center;
        line-height: 1.4;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .hero-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
        line-height: 1.6;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        margin-bottom: 2rem;
    }

    .hero-buttons .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        justify-content: center;
    }

    .hero-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-top: 2rem;
    }

    .stat-item {
        padding: 0.875rem;
        text-align: center;
    }

    .stat-number {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .hero-image {
        order: -1;
        margin: 0 auto;
    }

    .hero-logo-container {
        max-width: 200px;
        height: 200px;
        margin: 0 auto;
    }

    /* Sections */
    .features-section,
    .why-choose-section,
    .tech-stack-section,
    .download-section,
    .about-section,
    .academics-section,
    .facilities-section,
    .placement-section,
    .contact-section {
        padding: 2rem 0;
        margin: 0;
    }

    .section-header {
        margin-bottom: 1.5rem;
        text-align: center;
    }

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

    /* Grids - All Stack to Single Column */
    .features-grid,
    .why-choose-grid,
    .tech-features,
    .academics-grid,
    .facilities-grid,
    .contact-grid,
    .download-grid,
    .about-highlights,
    .achievements-grid {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Cards */
    .feature-card,
    .why-card,
    .tech-feature-item,
    .academic-card,
    .facility-card,
    .contact-card,
    .download-card,
    .highlight-item,
    .achievement-item {
        padding: 1.5rem;
        margin: 0;
    }

    .feature-icon,
    .why-icon,
    .tech-icon,
    .academic-icon,
    .facility-icon,
    .contact-icon,
    .download-icon {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    /* Vision/Mission */
    .vision-mission {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .vm-card {
        padding: 1.5rem;
    }

    /* Placement */
    .placement-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .placement-stat {
        padding: 1rem;
    }

    .placement-stat h3 {
        font-size: 1.75rem;
    }

    .recruiters-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .recruiter-tag {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
    }

    .footer-content {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-section {
        margin-bottom: 1rem;
    }

    /* Buttons - Touch Friendly */
    .btn,
    button,
    a.btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        cursor: pointer;
        border: none;
        border-radius: 8px;
        transition: all 0.2s ease;
    }

    .btn-large {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .btn-block {
        width: 100%;
        display: flex;
    }

    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
        padding: 0.875rem;
        min-height: 44px;
        width: 100%;
    }

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

    /* Login/Register Pages */
    .login-container,
    .register-container {
        padding: 1rem;
        min-height: 100vh;
    }

    .login-card,
    .register-card {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
    }

    .demo-accounts-mini {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .demo-item {
        width: 100%;
        padding: 0.75rem;
    }

    .role-selection {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .role-btn {
        width: 100%;
    }

    /* Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 0.85rem;
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    /* Theme Toggle */
    .theme-toggle {
        bottom: 80px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    /* Academic Features List */
    .academic-features {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .academic-features li {
        margin-bottom: 0.5rem;
    }

    /* Glass Cards */
    .glass-card {
        border-radius: 12px;
        padding: 1.25rem;
    }
}

/* ===================================
   Small Devices: 576px - 767px
   =================================== */
@media (min-width: 576px) and (max-width: 767px) {
    body {
        font-size: 15px;
    }

    h1, .hero-title {
        font-size: 2rem !important;
    }

    h2, .section-title {
        font-size: 1.75rem !important;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero-logo-container {
        max-width: 250px;
        height: 250px;
    }

    .features-grid,
    .why-choose-grid,
    .tech-features,
    .facilities-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .placement-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-highlights,
    .contact-grid,
    .download-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .demo-accounts-mini {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .demo-item {
        flex: 1;
        min-width: calc(50% - 0.5rem);
    }

    .role-selection {
        flex-direction: row;
    }
}

/* ===================================
   Tablets: 768px - 991px
   =================================== */
@media (min-width: 768px) and (max-width: 991px) {
    body {
        font-size: 15px;
    }

    .navbar {
        width: calc(100% - 2rem);
        top: 1rem;
        border-radius: 16px;
    }

    .hero-section .container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .hero-content {
        text-align: center;
    }

    .hero-badge {
        margin: 0 auto 1.5rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-stats {
        grid-template-columns: repeat(5, 1fr);
    }

    .hero-logo-container {
        max-width: 350px;
        height: 350px;
        margin: 0 auto;
    }

    .features-grid,
    .why-choose-grid,
    .tech-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .academics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .facilities-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .contact-grid,
    .download-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .placement-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }

    .mobile-menu-btn {
        display: none !important;
    }

    .nav-links {
        display: flex !important;
    }
}

/* ===================================
   Small Laptops: 992px - 1199px
   =================================== */
@media (min-width: 992px) and (max-width: 1199px) {
    .hero-section .container {
        grid-template-columns: 1.2fr 1fr;
        gap: 3rem;
    }

    .hero-content {
        text-align: left;
    }

    .hero-badge {
        margin: 0 0 1.5rem 0;
    }

    .hero-buttons {
        justify-content: flex-start;
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .academics-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .why-choose-grid,
    .tech-features {
        grid-template-columns: repeat(3, 1fr);
    }

    .facilities-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .contact-grid,
    .download-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .about-highlights {
        grid-template-columns: repeat(3, 1fr);
    }

    .achievements-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===================================
   Desktops: 1200px - 1919px
   =================================== */
@media (min-width: 1200px) {
    .hero-section .container {
        grid-template-columns: 1.3fr 1fr;
        gap: 4rem;
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    .academics-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .why-choose-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .tech-features {
        grid-template-columns: repeat(3, 1fr);
    }

    .facilities-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .contact-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .about-highlights {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===================================
   Large Desktops: 1920px+
   =================================== */
@media (min-width: 1920px) {
    .hero-title {
        font-size: 4.5rem !important;
    }

    .section-title {
        font-size: 3.5rem !important;
    }

    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===================================
   Landscape Mode (Mobile)
   =================================== */
@media (max-width: 900px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 2rem 0;
    }

    .hero-section .container {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .hero-logo-container {
        max-width: 200px;
        height: 200px;
    }

    .hero-stats {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.75rem;
    }

    .stat-item {
        padding: 0.5rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }
}

/* ===================================
   Touch-Friendly Enhancements
   =================================== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .hover-lift:hover {
        transform: none;
    }

    .hover-lift:active {
        transform: scale(0.98);
    }

    .hover-tilt:hover {
        transform: none;
    }

    /* Larger tap targets */
    button,
    a,
    .btn,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing for touch */
    .feature-card,
    .why-card,
    .academic-card {
        margin-bottom: 1rem;
    }
}

/* ===================================
   Safe Area Insets (Notch Support)
   =================================== */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .navbar {
        padding-left: calc(1rem + env(safe-area-inset-left));
        padding-right: calc(1rem + env(safe-area-inset-right));
    }

    @media (max-width: 768px) {
        .dashboard-main {
            padding-bottom: calc(90px + env(safe-area-inset-bottom));
        }
    }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    .navbar,
    .theme-toggle,
    .mobile-bottom-nav,
    .mobile-menu-btn,
    .bg-animation,
    .hero-buttons,
    footer,
    .demo-hint {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .glass-card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* ===================================
   Reduced Motion
   =================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   High Contrast Mode
   =================================== */
@media (prefers-contrast: high) {
    .glass-card {
        border: 2px solid currentColor;
    }

    .btn {
        border: 2px solid currentColor;
    }
}

/* ===================================
   Utility Classes
   =================================== */
/* Visibility */
.hide-mobile {
    display: none;
}

.show-mobile {
    display: block;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
    
    .show-mobile {
        display: none;
    }
}

/* Text Alignment */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
}

/* Flex Direction */
@media (max-width: 768px) {
    .flex-column-mobile {
        flex-direction: column !important;
    }
}

/* Width */
@media (max-width: 768px) {
    .w-100-mobile {
        width: 100% !important;
    }
}
