/* Responsive Design - CRM + Facturation */
/* Version 1.0.0 */

/* Mobile First Approach */

/* Extra small devices (phones, 575px and down) */
@media (max-width: 575px) {
    .container {
        padding: 0 15px;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0,0,0,0.05);
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .table-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .table-actions-cell {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .btn-sm {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .hero {
        padding: 3rem 0;
    }
    
    .hero h2 {
        font-size: 2.2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .action-buttons {
        flex-direction: row;
    }
    
    .btn {
        width: auto;
    }
    
    .form-actions {
        flex-direction: row;
    }
    
    .form-actions .btn {
        width: auto;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .nav-menu {
        position: static;
        flex-direction: row;
        width: auto;
        box-shadow: none;
        background: transparent;
    }
    
    .nav-toggle {
        display: none;
    }
    
    .hero h2 {
        font-size: 2.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .form-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .hero {
        padding: 4rem 0;
    }
    
    .hero h2 {
        font-size: 3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* Print styles */
@media print {
    .header,
    .footer,
    .nav-toggle,
    .btn,
    .table-actions,
    .form-actions {
        display: none !important;
    }
    
    .main {
        margin: 0;
        padding: 0;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .table-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .hero {
        background: none;
        color: #000;
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    
    .stat-card {
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: white;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        border-width: 3px;
    }
    
    .stat-card,
    .form-section,
    .table-container {
        border: 2px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroll-behavior {
        scroll-behavior: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .header {
        background: #2d2d2d;
    }
    
    .nav-brand h1 {
        color: #4dabf7;
    }
    
    .nav-link {
        color: #b0b0b0;
    }
    
    .nav-link:hover,
    .nav-link.active {
        color: #4dabf7;
        background-color: #1e3a5f;
    }
    
    .hero {
        background: linear-gradient(135deg, #1e3a5f 0%, #0f2540 100%);
    }
    
    .stat-card,
    .form-section,
    .table-container {
        background: #2d2d2d;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    .stat-card:hover {
        box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #1a1a1a;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        border-color: #4dabf7;
        background: #1e1e1e;
    }
    
    th {
        background: #1a1a1a;
        color: #b0b0b0;
    }
    
    td {
        border-bottom-color: #4d4d4d;
    }
    
    tr:hover {
        background: #1e3a5f;
    }
    
    .footer {
        background: #0d0d0d;
    }
    
    .message-success {
        background: #1e3a2e;
        color: #51cf66;
        border-color: #2d5a3d;
    }
    
    .message-error {
        background: #3a1e1e;
        color: #ff6b6b;
        border-color: #5d2d2d;
    }
    
    .message-warning {
        background: #3a2e1e;
        color: #ffd43b;
        border-color: #5d4d2d;
    }
    
    .message-info {
        background: #1e2e3a;
        color: #74c0fc;
        border-color: #2d4d5d;
    }
}
