/* ========================================
   RESPONSIVE CSS - All Screen Sizes
   ======================================== */

/* Root adjustments for scaling */
:root {
    --content-max-width: 100%;
    --sidebar-width: 280px;
}

/* ========================================
   LARGE DESKTOPS (1920px+)
   ======================================== */
@media (min-width: 1920px) {
    .content-section {
        max-width: 1800px;
        margin: 0 auto;
    }
}

/* ========================================
   STANDARD DESKTOPS (1440px - 1919px)
   ======================================== */
@media (max-width: 1919px) {
    :root {
        font-size: 15px;
    }
}

/* ========================================
   SMALL DESKTOPS / LAPTOPS (1024px - 1439px)
   ======================================== */
@media (max-width: 1439px) {
    :root {
        font-size: 13px;
        --sidebar-width: 220px;
    }

    /* Zmniejsz tabele żeby się mieściły */
    .admin-table {
        font-size: 0.75rem;
        min-width: auto !important;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.4rem 0.25rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .admin-table th:first-child,
    .admin-table td:first-child {
        padding-left: 0.5rem;
    }

    .admin-table th:last-child,
    .admin-table td:last-child {
        padding-right: 0.5rem;
    }

    /* Mniejsze przyciski w tabelach */
    .admin-action-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
    }

    .admin-action-btn i {
        font-size: 0.7rem;
    }

    .content-section {
        padding: 1rem;
    }

    .content-box {
        padding: 1.5rem;
    }

    /* Compact admin filters */
    .admin-filters {
        gap: 0.5rem;
    }

    .filter-group {
        min-width: 120px;
    }

    .filter-input {
        font-size: 0.8rem;
        padding: 0.4rem;
    }

    /* Timeline - pionowy, responsywny */
    .horizontal-timeline {
        padding: 1.5rem 0;
        max-width: 100%;
    }

    .timeline-icon {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }

    .timeline-content h6 {
        font-size: 1rem;
    }

    /* Mniejsze nagłówki */
    .content-header h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Statystyki - kompaktowe */
    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }
}

/* ========================================
   TABLETS LANDSCAPE / SMALL LAPTOPS (768px - 1023px)
   ======================================== */
@media (max-width: 1023px) {
    :root {
        --sidebar-width: 200px;
        font-size: 12px;
    }

    /* Sidebar adjustments */
    .sidebar {
        width: var(--sidebar-width);
    }

    /*
        USUNIETO `main { margin-left: var(--sidebar-width) }`.
        Ta regula obejmowala KAZDE <main> ponizej 1024 px i psula trzy rzeczy naraz:
          - na stronach publicznych (logowanie, zamowienie) nie ma menu bocznego,
            wiec tresc byla po prostu wepchnieta 200 px w prawo i wychodzila
            poza ekran,
          - w panelu miedzy 992 a 1023 px menu stoi w siatce #container, wiec
            margines dokladal drugie takie samo wciecie,
          - ponizej 992 px menu jest zsuniete poza ekran (position: fixed,
            left: -100%), wiec margines zostawial pusty pas przy lewej krawedzi.
        Szerokosc kolumny menu w panelu zalatwia grid #container, a nie margines.
    */

    /* Tabele - JESZCZE MNIEJSZE, bez scrolla */
    .admin-table-wrapper {
        overflow: visible;
        padding: 1rem;
    }

    .admin-table {
        min-width: auto !important;
        font-size: 0.7rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.3rem 0.15rem;
        font-size: 0.7rem;
    }

    /* Kolumny numeryczne węższe */
    .admin-table th[style*="width"],
    .admin-table td[style*="width"] {
        width: auto !important;
        min-width: 40px;
    }

    /* Przyciski jeszcze mniejsze */
    .admin-action-btn {
        font-size: 0.65rem;
        padding: 0.25rem 0.4rem;
        white-space: nowrap;
    }

    .admin-action-btn i {
        font-size: 0.65rem;
        margin-right: 0.2rem;
    }

    /* Stack filters vertically */
    .admin-filters,
    .filter-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    .filter-group {
        width: 100%;
        max-width: 100%;
    }

    /* Timeline - pionowy */
    .horizontal-timeline {
        padding: 1rem 0;
        gap: 1.5rem;
    }

    .timeline-icon {
        width: 55px;
        height: 55px;
        font-size: 1.1rem;
    }

    .timeline-content h6 {
        font-size: 0.95rem;
    }

    /* Compact content boxes */
    .content-box {
        padding: 1rem;
    }

    .content-section {
        padding: 0.8rem;
    }

    /* Responsive button groups */
    .admin-actions {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    /* Mniejsze nagłówki */
    .content-header h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 0.95rem;
    }
}

/* ========================================
   TABLETS PORTRAIT (600px - 767px)
   ======================================== */
@media (max-width: 767px) {
    /* Hide sidebar, show mobile menu */
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
    }

    .sidebar.active {
        left: 0;
    }

    main {
        margin-left: 0;
        width: 100%;
    }

    /* Show mobile menu button */
    .mobile-menu-toggle {
        display: block !important;
    }

    /* Full width content */
    .content-section {
        padding: 1rem;
        grid-template-columns: 1fr !important;
    }

    .content-box {
        padding: 1rem;
    }

    /* Hide desktop table, show mobile cards */
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    /* Timeline - już pionowy domyślnie, tylko dostosuj rozmiary */
    .horizontal-timeline {
        gap: 1.5rem;
        padding: 1rem 0;
    }

    .timeline-icon {
        width: 60px;
        height: 60px;
    }

    .timeline-content h6 {
        font-size: 0.95rem;
    }

    /* Stack form elements */
    .row {
        margin: 0 !important;
    }

    .row > [class*="col-"] {
        padding: 0 !important;
        margin-bottom: 1rem;
    }

    /* Full width inputs */
    .form-control,
    .filter-input {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Adjust spacing */
    h2, h3, h4 {
        font-size: 1.3rem;
    }

    /* Compact stat cards */
    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ========================================
   MOBILE LANDSCAPE (480px - 599px)
   ======================================== */
@media (max-width: 599px) {
    :root {
        font-size: 13px;
    }

    .content-header h2 {
        font-size: 1.3rem;
    }

    .admin-action-btn,
    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.7rem;
    }

    /* Smaller icons */
    .timeline-icon {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
    }
}

/* ========================================
   MOBILE PORTRAIT (320px - 479px)
   ======================================== */
@media (max-width: 479px) {
    :root {
        font-size: 12px;
    }

    .content-section {
        padding: 0.5rem;
    }

    .content-box {
        padding: 0.8rem;
        border-radius: 0.5rem;
    }

    /* Very compact buttons */
    .admin-action-btn,
    .btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }

    /* Smaller headings */
    .content-header h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 1rem;
    }

    /* Timeline adjustments */
    .timeline-icon {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }

    .timeline-content h6 {
        font-size: 0.85rem;
    }

    /* Compact tables */
    .admin-table th,
    .admin-table td {
        font-size: 0.75rem;
        padding: 0.3rem;
    }
}

/* ========================================
   UTILITY RESPONSIVE CLASSES
   ======================================== */

/* Container max-widths for different breakpoints */
.container-responsive {
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 576px) {
    .container-responsive {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container-responsive {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container-responsive {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container-responsive {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container-responsive {
        max-width: 1320px;
    }
}

/* Scrollable content for overflow */
.scrollable-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.scrollable-y {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Prevent text from breaking awkwardly */
.text-nowrap-responsive {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .text-nowrap-responsive {
        white-space: normal;
    }
}

/* Responsive flex utilities */
@media (max-width: 768px) {
    .flex-column-mobile {
        flex-direction: column !important;
    }

    .align-stretch-mobile {
        align-items: stretch !important;
    }
}

/* Hide/Show based on screen size */
.hide-on-mobile {
    display: block;
}

.show-on-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }

    .show-on-mobile {
        display: block !important;
    }
}

/* Print styles - prevent breaking */
@media print {
    .sidebar,
    .admin-actions,
    .mobile-menu-toggle {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content-section {
        padding: 0 !important;
    }

    .admin-table {
        font-size: 0.8rem;
    }
}

/* Smooth scrolling for all browsers */
html {
    scroll-behavior: smooth;
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive video embeds */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
