/* Mobile-first responsive design pro Taskering CRM */

/* ===== MOBILE VIEW (< 768px) ===== */
@media (max-width: 767.98px) {
    /* Skrýt sidebar na mobilu (pouze overlay) */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
        overflow-y: auto;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    /* Mobile overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }
    
    .mobile-overlay.show {
        display: block;
    }
    
    /* Hlavní obsah - full width na mobilu */
    .dashboard-content,
    .main-content {
        width: 100%;
        padding: 0.5rem;
        padding-bottom: 80px; /* Místo pro bottom nav */
    }
    
    /* Dashboard container - full width na mobilu */
    .dashboard-container {
        width: 100%;
    }
    
    /* Mobile header - sticky top bar */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: white;
        z-index: 1000;
        padding: 0.75rem;
        border-bottom: 1px solid #dee2e6;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    /* Upravit desktop header na mobilu - zobrazit pouze hledání */
    .content-header {
        display: block !important;
        position: sticky;
        top: 0;
        z-index: 100;
        margin-bottom: 1rem;
        margin-top: 0;
        padding: 0.75rem;
    }
    
    /* Skrýt některé prvky na mobilu */
    .content-header #globalTimerIndicator,
    .content-header .quick-actions,
    .content-header #notificationsDropdown {
        display: none !important;
    }
    
    /* Hledání zůstává viditelné a plně funkční */
    .content-header .global-search {
        width: 100%;
        margin: 0;
    }
    
    /* Zobrazit mobile header */
    .mobile-header {
        display: block !important;
    }
    
    .mobile-header .d-flex {
        align-items: center;
    }
    
    /* Karty - menší padding na mobilu */
    .card {
        margin-bottom: 0.75rem;
        border-radius: 0.5rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .card-header {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Tlačítka - větší pro touch */
    .btn {
        min-height: 44px; /* Apple HIG doporučuje minimálně 44x44px */
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.375rem 0.75rem;
    }
    
    /* Tabulky - scrollovatelné */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Formuláře */
    .form-control, .form-select {
        font-size: 16px; /* Zabraňuje zoom na iOS */
        padding: 0.5rem;
    }
    
    /* Skrýt některé sloupce v tabulkách */
    .table .d-none-mobile {
        display: none !important;
    }
    
    /* Floating Action Button (FAB) pro time tracking */
    .fab-time-tracking {
        position: fixed;
        bottom: 90px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #007bff;
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(0,123,255,0.4);
        z-index: 999;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .fab-time-tracking:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0,123,255,0.5);
    }
    
    .fab-time-tracking.running {
        background: #dc3545;
        animation: pulse 2s infinite;
    }
    
    @keyframes pulse {
        0%, 100% {
            box-shadow: 0 4px 12px rgba(220,53,69,0.4);
        }
        50% {
            box-shadow: 0 4px 20px rgba(220,53,69,0.7);
        }
    }
    
    /* Notification badge v mobile header */
    #mobile-notification-toggle.has-notifications {
        position: relative;
    }
    
    #mobile-notification-toggle .notification-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: #dc3545;
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        border: 2px solid white;
    }
    
    /* Mobile bottom navigation */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #dee2e6;
        padding: 0.5rem 0;
        z-index: 1000;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    }
    
    .mobile-bottom-nav .nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    .mobile-bottom-nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.25rem 0.5rem;
        color: #6c757d;
        text-decoration: none;
        font-size: 0.7rem;
    }
    
    .mobile-bottom-nav .nav-link.active {
        color: #007bff;
    }
    
    .mobile-bottom-nav .nav-link img {
        width: 24px;
        height: 24px;
        margin-bottom: 0.25rem;
    }
    
    /* Úkoly na dnešek - mobile card */
    .today-tasks-mobile {
        margin-bottom: 1rem;
    }
    
    .today-tasks-mobile .task-item {
        padding: 0.75rem;
        border-left: 4px solid #007bff;
        margin-bottom: 0.5rem;
        background: white;
        border-radius: 0.25rem;
    }
    
    .today-tasks-mobile .task-item.urgent {
        border-left-color: #dc3545;
    }
    
    .today-tasks-mobile .task-item.high {
        border-left-color: #fd7e14;
    }
    
    .today-tasks-mobile .task-item.medium {
        border-left-color: #ffc107;
    }
    
    /* Time tracking widget - mobile */
    .time-tracking-mobile {
        position: sticky;
        top: 60px;
        background: white;
        padding: 0.75rem;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        z-index: 100;
    }
    
    .time-tracking-mobile.running {
        background: #fff3cd;
        border: 2px solid #ffc107;
    }
    
    /* Notification drawer */
    .notification-drawer {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 400px;
        height: 100vh;
        background: white;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        z-index: 1050;
        transition: right 0.3s ease;
        overflow-y: auto;
    }
    
    .notification-drawer.show {
        right: 0;
    }
    
    .notification-drawer-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
        background: #f8f9fa;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .notification-item {
        padding: 0.75rem;
        border-bottom: 1px solid #f0f0f0;
        cursor: pointer;
    }
    
    .notification-item.unread {
        background: #e7f3ff;
    }
    
    .notification-item:hover {
        background: #f8f9fa;
    }
}

/* ===== TABLET VIEW (768px - 991px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Sidebar - užší na tabletu */
    .sidebar {
        width: 220px;
    }
    
    .dashboard-content {
        margin-left: 220px;
        padding: 1rem;
    }
    
    /* Karty - 2 sloupce kde je to možné */
    .card-grid-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Tabulky - zobrazit více sloupců */
    .table .d-none-mobile {
        display: table-cell !important;
    }
}

/* ===== DESKTOP VIEW (> 992px) ===== */
@media (min-width: 992px) {
    /* Skrýt mobile-only prvky */
    .mobile-header,
    .mobile-bottom-nav,
    .fab-time-tracking,
    .notification-center-mobile {
        display: none !important;
    }
}

/* ===== QUOTES MODULE - MOBILE ===== */
@media (max-width: 767.98px) {
    /* Scrollovatelne filtry */
    .quotes-status-filter {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .quotes-status-filter::-webkit-scrollbar {
        display: none;
    }
    
    /* Karty nabidek */
    .quote-card {
        background: white;
        transition: background 0.2s ease;
    }
    
    .quote-card:active {
        background: #f8f9fa;
    }
    
    /* Responzivni tlacitka */
    .btn-sm.btn-md-normal {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Sticky souhrn na mobilu */
    .quote-mobile-summary {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 0.75rem 1rem;
        border-top: 1px solid #dee2e6;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }
    
    /* Padding pro obsah nad sticky */
    .container-fluid {
        padding-bottom: 80px;
    }
    
    /* Mensi tabulky v sekcich */
    .section-container .table th,
    .section-container .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    /* Skryt sloupce na mobilu */
    .section-container .table th:nth-child(2),
    .section-container .table td:nth-child(2) {
        display: none;
    }
}

@media (min-width: 768px) {
    .btn-sm.btn-md-normal {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .quote-mobile-summary {
        display: none !important;
    }
}

/* ===== UTILITY CLASSES ===== */
.d-mobile-none {
    display: none !important;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block !important;
    }
}

.d-mobile-block {
    display: block !important;
}

@media (min-width: 768px) {
    .d-mobile-block {
        display: none !important;
    }
}

/* Touch-friendly spacing */
@media (max-width: 767.98px) {
    .mb-mobile-2 {
        margin-bottom: 0.5rem !important;
    }
    
    .p-mobile-2 {
        padding: 0.5rem !important;
    }
}
