/* ============================================
   MAK TEAM HQ - Responsive Design
   Styles for all screen sizes
   ============================================ */

/* ============================================
   EXTRA LARGE SCREENS (1400px+)
   ============================================ */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    .hero h1 {
        font-size: 4rem;
    }

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

    .members-grid {
        grid-template-columns: repeat(6, 1fr);
    }

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

/* ============================================
   LARGE SCREENS (1200px - 1399px)
   ============================================ */
@media (max-width: 1399px) {
    .container {
        max-width: 1140px;
    }

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

/* ============================================
   MEDIUM SCREENS / TABLETS (992px - 1199px)
   ============================================ */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }

    .hero h1 {
        font-size: 3rem;
    }

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

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

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

/* ============================================
   TABLETS (768px - 991px)
   ============================================ */
@media (max-width: 991px) {
    .manage-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .container {
        max-width: 720px;
        padding: 0 1.5rem;
    }

    /* Navigation */
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 15, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        padding: 2rem;
        gap: 1rem;
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-150%);
        opacity: 0;
        transition: all 0.3s ease;
        pointer-events: none;
        z-index: 999;
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 1rem;
        font-size: 1.1rem;
    }

    .menu-toggle {
        display: flex;
    }

    /* Hero */
    .hero {
        padding-top: 100px;
        min-height: auto;
        padding-bottom: 3rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero .tagline {
        font-size: 1.1rem;
    }

    .hero-logo {
        width: 180px;
        height: 180px;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: 1.5rem;
    }

    .stat-item {
        min-width: 100px;
    }

    /* Sections */
    .section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 2rem;
    }

    /* Grids */
    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

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

    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Dashboard */
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .dashboard-main {
        margin-right: 0;
        padding: 1rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* Cards */
    .card {
        padding: 1.25rem;
    }

    .member-card {
        padding: 1.5rem;
    }

    /* Filter bar */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }
}

/* ============================================
   SMALL TABLETS / LARGE PHONES (576px - 767px)
   ============================================ */
@media (max-width: 767px) {
    .container {
        max-width: 540px;
        padding: 0 1rem;
    }

    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Hero */
    .hero h1 {
        font-size: 2rem;
    }

    .hero .tagline {
        font-size: 1rem;
        white-space: normal;
        animation: none;
        border: none;
        width: auto;
    }

    .hero-logo {
        width: 150px;
        height: 150px;
    }

    .hero-stats {
        gap: 1rem;
    }

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

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

    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        padding: 0 1rem;
    }

    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* Grids */
    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .members-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Member cards */
    .member-avatar {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .member-name {
        font-size: 1.2rem;
    }

    .member-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Project cards */
    .project-card {
        padding: 1rem;
    }

    .project-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Section headers */
    .section-header {
        margin-bottom: 2rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

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

    /* Dashboard stats */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card-value {
        font-size: 2rem;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-page {
        padding: 1rem;
    }

    /* Panels */
    .panel-header {
        padding: 1rem;
    }

    .panel-body {
        padding: 1rem;
    }

    /* Contribution chart */
    .contribution-item {
        flex-wrap: wrap;
    }

    .contribution-info {
        width: 100%;
        order: 1;
    }

    .contribution-avatar {
        order: 0;
    }

    .contribution-value {
        order: 2;
        margin-right: auto;
    }

    /* Calendar */
    .calendar-day {
        font-size: 0.8rem;
        padding: 0.25rem;
    }

    .calendar-day-name {
        font-size: 0.7rem;
        padding: 0.5rem 0.25rem;
    }

    /* Footer */
    .footer {
        padding: 2rem 1rem;
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 1rem;
    }

    /* CTA */
    .cta-box {
        padding: 2rem 1.5rem;
    }

    .cta-box h2 {
        font-size: 1.5rem;
    }

    /* Ticker */
    .ticker-content span {
        font-size: 0.8rem;
    }

    /* Modals */
    .modal {
        width: 95%;
        max-height: 85vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    /* Team size selector */
    .team-size-selector {
        flex-wrap: wrap;
    }

    .team-size-option {
        min-width: 50px;
        flex: 1 1 calc(33.333% - 0.5rem);
    }

    /* Priority selector */
    .priority-selector {
        flex-wrap: wrap;
    }

    .priority-option {
        flex: 1 1 calc(50% - 0.25rem);
    }

    /* Quick actions */
    .quick-actions {
        bottom: 20px;
        left: 15px;
    }

    .quick-actions-toggle {
        width: 50px;
        height: 50px;
    }

    /* Sound toggle */
    .sound-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        bottom: 15px;
        right: 15px;
    }

    /* Level badge */
    .level-badge {
        padding: 0.75rem;
    }

    .level-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    /* Achievements */
    .achievement-badge {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .achievement-badge .tooltip {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ============================================
   PHONES (less than 576px)
   ============================================ */
@media (max-width: 575px) {
    :root {
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }

    body {
        font-size: 14px;
    }

    .container {
        padding: 0 0.75rem;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    /* Navbar */
    .navbar {
        height: 60px;
    }

    .navbar .container {
        padding: 0 0.75rem;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    .logo img {
        height: 40px;
    }

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

    /* Hero */
    .hero {
        padding-top: 80px;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero .tagline {
        font-size: 0.9rem;
    }

    .hero-logo {
        width: 120px;
        height: 120px;
        margin-bottom: 1rem;
    }

    .hero-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        width: 100%;
        padding: 0;
        box-sizing: border-box;
    }

    .stat-item {
        background: var(--bg-card);
        padding: 1rem;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
    }

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

    /* Grids */
    .subjects-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .subject-card {
        padding: 1rem;
    }

    .subject-icon {
        font-size: 2rem;
    }

    .subject-name {
        font-size: 0.9rem;
    }

    .subject-count {
        font-size: 0.75rem;
    }

    .members-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .member-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        text-align: right;
    }

    .member-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin: 0;
        flex-shrink: 0;
    }

    .member-card .member-stats {
        margin-top: 0.5rem;
        justify-content: flex-start;
    }

    /* Dashboard */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .stat-card-icon {
        font-size: 2rem;
        margin-bottom: 0;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    /* Sidebar */
    .sidebar {
        width: 100%;
        top: 60px;
        height: calc(100vh - 60px);
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }

    /* Forms */
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    /* Login page */
    .login-card {
        padding: 2rem 1.5rem;
    }

    .login-logo {
        width: 100px;
        height: 100px;
    }

    .login-title {
        font-size: 1.5rem;
    }

    /* Table adjustments */
    .projects-table {
        display: block;
        overflow-x: auto;
    }

    .projects-table th,
    .projects-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Notification dropdown */
    .notification-dropdown {
        width: calc(100vw - 2rem);
        left: 50%;
        transform: translateX(-50%);
    }

    /* Timeline */
    .timeline::before {
        right: 15px;
    }

    .timeline-item {
        padding-right: 40px;
    }

    .timeline-dot {
        right: 8px;
        width: 14px;
        height: 14px;
    }

    /* Footer */
    .footer-logo {
        width: 60px;
    }

    .footer-text {
        font-size: 0.85rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Section spacing */
    .section {
        padding: 2rem 0;
    }

    .section-title::after {
        width: 40px;
    }
}

/* ============================================
   EXTRA SMALL PHONES (less than 375px)
   ============================================ */
@media (max-width: 374px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero-logo {
        width: 100px;
        height: 100px;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

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

    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ============================================
   LANDSCAPE PHONES
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 80px 0 2rem;
    }

    .hero-logo {
        width: 100px;
        height: 100px;
    }

    .hero-stats {
        gap: 1.5rem;
    }

    .level-container {
        display: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    .navbar,
    .loading-screen,
    #particles-container,
    .matrix-rain,
    .sound-toggle,
    .quick-actions,
    .footer {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        border: 1px solid #ccc;
        background: white;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) {

    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
    }

    .card-3d:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    /* Increase tap targets */
    .nav-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn {
        min-height: 44px;
    }

    /* Show tooltips on tap */
    .achievement-badge .tooltip {
        display: 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;
    }

    .loading-screen {
        display: none;
    }

    .particle {
        display: none;
    }

    .matrix-rain {
        display: none;
    }
}

/* ============================================
   DARK MODE ENHANCEMENTS
   ============================================ */
@media (prefers-color-scheme: dark) {

    /* Already dark by default, but ensure consistency */
    :root {
        color-scheme: dark;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {
    :root {
        --border-color: #ffffff;
        --text-secondary: #cccccc;
    }

    .card {
        border-width: 2px;
    }

    .btn {
        border-width: 2px;
    }
}