/* ==================== RESPONSIVE DESIGN ==================== */

/* Variables de breakpoints */
:root {
    --bp-mobile-s: 320px;
    --bp-mobile-m: 375px;
    --bp-mobile-l: 425px;
    --bp-tablet: 768px;
    --bp-laptop: 1024px;
    --bp-laptop-l: 1440px;
    --bp-desktop: 2560px;
}

/* ==================== MOBILE FIRST - SMALL DEVICES ==================== */

@media (max-width: 425px) {
    /* Typography */
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.8rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

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

    /* Containers */
    .container {
        padding: 10px !important;
        margin: 0 !important;
    }

    /* Fleet Grid */
    #shipGrid,
    .ship-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .ship-card {
        padding: 12px !important;
    }

    /* Fleet Panel (Sidebar) */
    .fleet-panel {
        width: 100% !important;
        position: static !important;
        margin-bottom: 20px;
    }

    .fleet-container {
        flex-direction: column !important;
        padding: 10px !important;
    }

    /* Buttons */
    .btn-primary,
    .btn-secondary,
    .action-btn {
        width: 100%;
        padding: 12px !important;
        font-size: 14px;
    }

    /* Modals */
    .modal-content {
        width: 95% !important;
        margin: 20px auto !important;
        padding: 15px !important;
    }

    /* Forms */
    .form-group {
        margin-bottom: 12px;
    }

    input,
    select,
    textarea {
        font-size: 16px !important; /* Évite le zoom sur iOS */
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px;
    }

    .stat-item {
        padding: 10px !important;
        font-size: 0.9rem;
    }

    /* Toast notifications */
    .toast {
        width: calc(100% - 20px) !important;
        left: 10px !important;
        right: 10px !important;
    }

    /* Theme toggle */
    .theme-toggle {
        width: 45px !important;
        height: 45px !important;
        bottom: 15px !important;
        right: 15px !important;
        font-size: 18px !important;
    }

    /* Tables */
    table {
        font-size: 0.85rem;
    }

    table th,
    table td {
        padding: 8px 4px !important;
    }

    /* Hide non-essential columns on mobile */
    .hide-mobile {
        display: none !important;
    }
}

/* ==================== TABLETS ==================== */

@media (min-width: 426px) and (max-width: 768px) {
    /* Typography */
    h1 {
        font-size: 2.2rem !important;
    }

    h2 {
        font-size: 1.8rem !important;
    }

    /* Fleet Grid */
    #shipGrid,
    .ship-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    /* Fleet Panel */
    .fleet-panel {
        width: 250px !important;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Modals */
    .modal-content {
        width: 90% !important;
        max-width: 600px;
    }

    /* Toast */
    .toast {
        max-width: 400px;
    }
}

/* ==================== LAPTOPS ==================== */

@media (min-width: 769px) and (max-width: 1024px) {
    /* Fleet Grid */
    #shipGrid,
    .ship-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Fleet Panel */
    .fleet-panel {
        width: 280px !important;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==================== LARGE SCREENS ==================== */

@media (min-width: 1025px) and (max-width: 1440px) {
    /* Fleet Grid */
    #shipGrid,
    .ship-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (min-width: 1441px) {
    /* Fleet Grid */
    #shipGrid,
    .ship-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }

    /* Max container width */
    .container {
        max-width: 1600px;
        margin: 0 auto;
    }
}

/* ==================== LANDSCAPE MODE ==================== */

@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce vertical spacing */
    .hero {
        padding: 40px 20px !important;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }

    .fleet-panel {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ==================== TOUCH DEVICES ==================== */

@media (hover: none) and (pointer: coarse) {
    /* Augmenter les zones tactiles */
    button,
    a,
    input,
    select {
        min-height: 44px;
        min-width: 44px;
    }

    /* Désactiver hover effects sur touch */
    .hover-lift:hover,
    .hover-scale:hover {
        transform: none;
    }

    /* Active state au lieu de hover */
    button:active,
    a:active,
    .ship-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Simplifier le drag & drop sur mobile */
    .draggable {
        cursor: grab;
    }

    .dragging {
        opacity: 0.8;
    }
}

/* ==================== PRINT ==================== */

@media print {
    /* Masquer les éléments non imprimables */
    nav,
    .theme-toggle,
    .action-btn,
    .ship-actions,
    .toast,
    .loader,
    footer {
        display: none !important;
    }

    /* Optimiser pour l'impression */
    body {
        background: white;
        color: black;
    }

    .ship-card {
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }

    /* Afficher les liens */
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ==================== 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 ==================== */

@media (prefers-contrast: high) {
    :root[data-theme="dark"],
    :root[data-theme="light"] {
        --border-color: currentColor;
        --text-muted: var(--text-secondary);
    }

    button,
    .ship-card,
    .modal-content {
        border: 2px solid currentColor !important;
    }
}

}
