/* Mobile-friendly table cards - eliminates horizontal scroll */
@media (max-width: 767.98px) {
    table.mobile-cards { border: 0; width: 100%; }
    table.mobile-cards thead { display: none; }
    table.mobile-cards tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    }
    table.mobile-cards tbody td {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.6rem 0.85rem;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        text-align: left !important;
    }
    table.mobile-cards tbody td:last-child { border-bottom: 0; }
    table.mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        font-size: 0.8125rem;
        flex: 0 0 auto;
        min-width: 90px;
    }
    table.mobile-cards tbody td > * { margin-left: auto; }
    table.mobile-cards tbody td:empty { display: none; }
}

@media (min-width: 768px) {
    table.mobile-cards tbody td::before { display: none !important; }
    table.mobile-cards tbody td { display: table-cell; }
    table.mobile-cards thead { display: table-header-group; }
}

/* GastroFlow - Custom Styles */
:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --primary-dark: #0d1b2a;
    --accent: #f4a261;
    --accent-hover: #e76f51;
    --bg-light: #f0f2f5;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --card-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%) !important;
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
    padding: 0.75rem 1.5rem;
}
.navbar-brand { font-size: 1.25rem; letter-spacing: -0.5px; }
.navbar .nav-link { padding: 0.5rem 0.8rem; border-radius: 8px; transition: var(--transition); font-size: 0.9rem; white-space: nowrap; display: flex; align-items: center; }
.navbar .nav-link:hover, .navbar .nav-link.active { background: rgba(255,255,255,0.12); }
.navbar .nav-link.active { font-weight: 600; }
.user-info { line-height: 1.3; }

/* Content */
.content-wrapper { flex: 1; padding: 0; }
.page-title { font-weight: 700; color: var(--primary-dark); font-size: 1.6rem; }

/* Cards */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); }

.action-card { cursor: pointer; border: 1px solid #e9ecef; }
.action-card:hover { border-color: var(--accent); }
.action-card h4, .action-card h5 { color: var(--primary-dark); font-weight: 600; }

/* Stat cards */
.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.stat-icon {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff;
}
.stat-info h3 { margin: 0; font-size: 1.8rem; font-weight: 700; color: var(--primary-dark); }
.stat-info p { margin: 0; color: #6c757d; font-size: 0.85rem; }

/* Status badges */
.status-badge { padding: 0.35em 0.75em; border-radius: 20px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; }
.status-new { background: #e3f2fd; color: #1565c0; }
.status-assigned { background: #f3e5f5; color: #7b1fa2; }
.status-in-progress { background: #fff3e0; color: #e65100; }
.status-waiting-parts { background: #fce4ec; color: #c62828; }
.status-done { background: #e8f5e9; color: #2e7d32; }
.status-closed { background: #eceff1; color: #455a64; }
.status-critical { background: #ffebee; color: #b71c1c; }

/* Tables */
.table { border-radius: 8px; overflow: hidden; }
.table thead th { background: var(--primary); color: #fff; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; border: none; padding: 0.85rem 1rem; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: #e8eaf6; }
.table tbody td { vertical-align: middle; padding: 0.75rem 1rem; }

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border: 1.5px solid #dee2e6;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.15);
}
.input-group-text { border-radius: 8px 0 0 8px; background: var(--primary); color: #fff; border: none; }

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none; border-radius: 8px;
    font-weight: 600; padding: 0.6rem 1.5rem;
    transition: var(--transition);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3); background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%); }

.btn-accent { background: var(--accent); color: #fff; border: none; border-radius: 8px; font-weight: 600; }
.btn-accent:hover { background: var(--accent-hover); color: #fff; }

/* Login page */
.login-page {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #303f9f 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.login-wrapper { width: 100%; max-width: 420px; }
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
}
.login-icon i { font-size: 1.8rem; color: #fff; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 0.25rem; }
.login-header p { color: #6c757d; font-size: 0.9rem; }
.login-footer { text-align: center; margin-top: 1.5rem; color: #adb5bd; }

/* Footer */
.site-footer {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    margin-top: auto;
}
.site-footer p { font-size: 0.85rem; color: #6c757d; }

/* Animations */
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* Mobile card */
.mobile-card { border-radius: 12px; margin-bottom: 1rem; border-left: 4px solid var(--primary); }
.mobile-card .card-body { padding: 1.25rem; }

/* Responsive */
@media (max-width: 768px) {
    .navbar { padding: 0.5rem 1rem; }
    .page-title { font-size: 1.3rem; }
    .stat-card { padding: 1rem; }
    .stat-icon { width: 44px; height: 44px; font-size: 1.1rem; }
    .stat-info h3 { font-size: 1.4rem; }
    .content-wrapper { padding: 0; }
    .card { border-radius: 10px; }
    .btn { padding: 0.75rem 1.25rem; font-size: 1rem; }
    .table-responsive { border-radius: 8px; }
}
@media (max-width: 576px) {
    .login-card { padding: 1.75rem; }
    .action-card .card-body { padding: 1.5rem !important; }
}

@media (max-width: 991px) {
    .navbar { padding: 0.5rem 1rem; }
}

/* Mobile enhancements */
@media (max-width: 768px) {
    .container-fluid { padding-left: 1rem; padding-right: 1rem; }
    .page-title { font-size: 1.2rem; }
    
    .action-card .card-body { padding: 1.25rem !important; }
    .action-card i.fa-2x, .action-card i.fa-3x { font-size: 1.8rem !important; }
    .action-card h4, .action-card h5 { font-size: 1rem; }
    .action-card p { font-size: 0.8rem; }
    
    .stat-card { padding: 1rem; gap: 0.75rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1rem; border-radius: 10px; }
    .stat-info h3 { font-size: 1.3rem; }
    .stat-info p { font-size: 0.75rem; }
    
    .table thead th { font-size: 0.75rem; padding: 0.6rem 0.5rem; }
    .table tbody td { font-size: 0.85rem; padding: 0.6rem 0.5rem; }
    
    .btn { min-height: 44px; font-size: 0.95rem; }
    .form-control, .form-select { min-height: 44px; font-size: 1rem; }
    
    .site-footer { text-align: center; }
    .site-footer .row > div { text-align: center !important; }
}

/* Mobile task cards (Serwisant view) */
.task-card-mobile {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}
.task-card-mobile:active { transform: scale(0.98); }
.task-card-mobile .task-title { font-weight: 600; font-size: 1rem; color: var(--primary-dark); margin-bottom: 0.5rem; }
.task-card-mobile .task-meta { font-size: 0.8rem; color: #6c757d; }
.task-card-mobile .task-meta i { width: 18px; }
.task-card-mobile .task-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; }
.task-card-mobile .task-actions .btn { flex: 1; font-size: 0.85rem; padding: 0.5rem; }

.task-card-mobile.priority-high { border-left-color: #e65100; }
.task-card-mobile.priority-critical { border-left-color: #b71c1c; }
.task-card-mobile.priority-medium { border-left-color: #f4a261; }
.task-card-mobile.priority-low { border-left-color: #2e7d32; }

/* Pull to refresh indicator */
.mobile-header-bar {
    display: none;
    background: #fff;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 100;
}
@media (max-width: 991px) { .mobile-header-bar { display: flex; align-items: center; justify-content: space-between; } }
.mobile-header-bar h5 { margin: 0; font-weight: 700; font-size: 1.1rem; }

/* Coldroom / ChÄąâ€šodnia monitoring */
.coldroom-strip {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 4px 12px 4px;
    margin-bottom: -4px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.coldroom-strip::-webkit-scrollbar {
    height: 6px;
}
.coldroom-strip::-webkit-scrollbar-track {
    background: transparent;
}
.coldroom-strip::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
.coldroom-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    padding: 6px 18px 6px 6px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.coldroom-chip:hover {
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}
.coldroom-chip-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: inset 0 -2px 5px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
}
.coldroom-chip-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
    white-space: nowrap;
}
.coldroom-chip-name {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1px;
}
.coldroom-chip-temp {
    font-size: 1.3rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}
.coldroom-card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border-left: 4px solid #17a2b8;
    overflow: hidden;
}
.coldroom-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}
.coldroom-card.alarm-active {
    border-left-color: #dc3545;
    animation: coldroomPulse 2s infinite;
}

.coldroom-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.coldroom-temp {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

@keyframes coldroomPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.3); }
    50% { box-shadow: 0 0 15px 5px rgba(220, 53, 69, 0.15); }
}

@media (max-width: 768px) {
    .coldroom-temp {
        font-size: 1.4rem;
    }
    .coldroom-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}
