/* ============================================================
   ShopCode — CSS
   Mobile-first: base = mobil, media queries = desktop
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS proměnné ────────────────────────────────────────── */
:root {
    --background:          0 0% 98%;
    --foreground:          240 10% 3.9%;
    --card:                0 0% 100%;
    --card-foreground:     240 10% 3.9%;
    --primary:             348 83% 47%;
    --primary-foreground:  0 0% 98%;
    --secondary:           240 4.8% 95.9%;
    --secondary-foreground:240 5.9% 10%;
    --muted:               240 4.8% 95.9%;
    --muted-foreground:    240 3.8% 46.1%;
    --accent:              240 4.8% 95.9%;
    --accent-foreground:   240 5.9% 10%;
    --destructive:         0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border:              240 5.9% 90%;
    --input:               240 5.9% 90%;
    --ring:                348 83% 47%;
    --radius:              0.5rem;
    --gradient-primary:    linear-gradient(135deg, hsl(348,83%,47%), hsl(348,83%,57%));
    --gradient-subtle:     linear-gradient(180deg, hsl(0,0%,98%), hsl(240,4.8%,95.9%));
    --shadow-shopcode:     0 4px 20px hsl(348,83%,47%,.15);
    --shadow-elegant:      0 10px 30px -10px hsl(348,83%,47%,.3);
    --sidebar-background:  0 0% 98%;
    --sidebar-foreground:  240 5.3% 26.1%;
    --sidebar-primary:     348 83% 47%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent:      240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border:      220 13% 91%;
    --sidebar-ring:        348 83% 47%;

    --sidebar-width:       256px;
    --topbar-h:            56px;
    --bottom-nav-h:        64px;
}

/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: hsl(var(--border)); }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; font-family: Inter, sans-serif; }
body {
    margin: 0; line-height: inherit;
    font-family: Inter, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    --bs-body-bg: hsl(var(--background));
    --bs-body-color: hsl(var(--foreground));
}

/* ── Wrapper ────────────────────────────────────────────── */
#wrapper { min-height: 100vh; display: flex; width: 100%; background-color: hsl(var(--background)); }

/* ══════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════ */

/* Mobile: skrytý drawer */
#sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100%;
    background-image: var(--gradient-subtle);
    border-right: 1px solid hsl(var(--sidebar-border));
    z-index: 1060;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

#sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgb(0 0 0 / .15);
}

/* Desktop: vždy viditelný */
@media (min-width: 768px) {
    #sidebar {
        width: var(--sidebar-width);
        transform: translateX(0) !important;
        box-shadow: none;
        position: fixed;
        border-right: 1px solid hsl(var(--sidebar-border));
    }
}

/* Overlay za sidebar (jen mobil) */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1055;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: overlayIn .25s ease;
}
#sidebar-overlay.active { display: block; }
@media (min-width: 768px) {
    #sidebar-overlay { display: none !important; }
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Sidebar: logo */
.sidebar-brand {
    padding: 1rem;
    border-bottom: 1px solid hsl(var(--border) / .5);
    flex-shrink: 0;
}
.sidebar-brand a { text-decoration: none; display: flex; align-items: center; gap: .75rem; }
.sidebar-brand img { width: 2.5rem; height: auto; }
.sidebar-brand-text h2 {
    font-size: 1.125rem; font-weight: 700;
    color: hsl(var(--primary)); margin: 0; line-height: 1.2;
}
.sidebar-brand-text p { font-size: .75rem; color: hsl(var(--muted-foreground)); margin: 0; }

/* Sidebar: uživatel */
.sidebar-user {
    padding: 1rem;
    border-bottom: 1px solid hsl(var(--border) / .5);
    display: flex; align-items: center; gap: .75rem;
    flex-shrink: 0;
}
.sidebar-user .user-name { font-weight: 500; font-size: .875rem; color: hsl(var(--foreground)); }
.sidebar-user .user-email { font-size: .75rem; color: hsl(var(--muted-foreground)); }

/* Sidebar: nav */
.sidebar-nav { padding: .25rem 0; list-style: none; margin: 0; flex: 1; overflow-y: auto; }

.sidebar-section-title {
    padding: 1rem 1rem .375rem;
    font-size: .75rem; font-weight: 500;
    color: hsl(var(--sidebar-foreground) / .7);
    letter-spacing: .05em;
}

.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .5rem;
    padding: .625rem .75rem;
    margin: .125rem .5rem;
    border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--sidebar-foreground));
    font-size: .875rem; font-weight: 400;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
    border: 0;
    min-height: 44px; /* touch target */
}
.sidebar-nav .nav-link:hover {
    background-color: hsl(var(--sidebar-accent));
    color: hsl(var(--sidebar-accent-foreground));
}
.sidebar-nav .nav-link.active {
    background-color: hsl(var(--primary) / .1);
    color: hsl(var(--primary));
    font-weight: 500;
}
.sidebar-nav .nav-link i { width: 1rem; font-size: .875rem; flex-shrink: 0; text-align: center; }

/* Sidebar: bottom */
.sidebar-bottom {
    padding: .5rem;
    border-top: 1px solid hsl(var(--border) / .5);
    flex-shrink: 0;
}
.sidebar-bottom .nav-link {
    display: flex; align-items: center; gap: .5rem;
    padding: .625rem .75rem;
    margin: .125rem 0;
    border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--muted-foreground));
    font-size: .875rem; text-decoration: none;
    transition: color .15s, background .15s;
    min-height: 44px;
}
.sidebar-bottom .nav-link:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--foreground));
}
.sidebar-bottom .nav-link.logout:hover, .sidebar-bottom a.text-danger:hover {
    color: hsl(var(--destructive)) !important;
    background-color: hsl(var(--destructive) / .1);
}

/* ══════════════════════════════════════════════════════════
   PAGE CONTENT
   ══════════════════════════════════════════════════════════ */

#page-content {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-left: 0;
    max-width: 100%;
    overflow-x: hidden;
    min-width: 0;
    /* Prostor pro bottom nav na mobilu */
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    #page-content {
        margin-left: var(--sidebar-width);
        padding-bottom: 0;
    }
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background-color: hsl(var(--card) / .95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid hsl(var(--border));
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center;
    padding: 0 1rem;
    gap: .75rem;
    flex-shrink: 0;
}

.topbar .search-box {
    display: none; /* skryto na mobilu */
}

@media (min-width: 768px) {
    .topbar {
        height: 64px;
        padding: 0 1.5rem;
    }
    .topbar .search-box {
        display: flex; align-items: center; gap: .5rem;
        background-color: hsl(var(--muted) / .5);
        border: 0;
        border-radius: var(--radius);
        padding: .375rem .75rem;
        max-width: 320px; flex: 1;
    }
    .topbar .search-box i { color: hsl(var(--muted-foreground)); font-size: .875rem; }
    .topbar .search-box input {
        border: 0; background: transparent; outline: none;
        font-size: .875rem; color: hsl(var(--foreground)); width: 100%; font-family: inherit;
    }
    .topbar .search-box input::placeholder { color: hsl(var(--muted-foreground)); }
}

/* Hamburger */
#sidebarToggle {
    width: 40px; height: 40px;
    padding: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    #sidebarToggle { display: none !important; }
}

/* ══════════════════════════════════════════════════════════
   BOTTOM NAVIGATION (mobil only)
   ══════════════════════════════════════════════════════════ */

#mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: hsl(var(--card));
    border-top: 1px solid hsl(var(--border));
    z-index: 1040;
    padding: 0 .5rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 20px rgb(0 0 0 / .06);
}

@media (min-width: 768px) {
    #mobile-nav { display: none !important; }
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: hsl(var(--muted-foreground));
    font-size: .62rem;
    font-weight: 500;
    padding: .375rem .25rem;
    border-radius: 12px;
    transition: color .15s, background .15s, transform .1s;
    position: relative;
    min-width: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item i {
    font-size: 1.3rem;
    line-height: 1;
    transition: transform .2s;
}

.mobile-nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
}

.mobile-nav-item.active {
    color: hsl(var(--primary));
}

.mobile-nav-item.active i {
    transform: scale(1.1);
}

.mobile-nav-item:active {
    transform: scale(0.92);
}

/* Aktivní tečka */
.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: hsl(var(--primary));
}

/* Badge na notifikace */
.mobile-nav-badge {
    position: absolute;
    top: 5px;
    right: calc(50% - 20px);
    background: hsl(var(--destructive));
    color: #fff;
    font-size: .55rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid hsl(var(--card));
    line-height: 1;
}

/* ══════════════════════════════════════════════════════════
   AVATAR
   ══════════════════════════════════════════════════════════ */

.avatar-circle {
    width: 2.5rem; height: 2.5rem;
    border-radius: 9999px;
    background-image: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    font-weight: 600; font-size: .875rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-sm { width: 2rem; height: 2rem; font-size: .75rem; }

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */

.card {
    background-color: hsl(var(--card)) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
    color: hsl(var(--card-foreground));
}
.card-header {
    background: transparent !important;
    border-bottom: 1px solid hsl(var(--border)) !important;
    padding: 1rem !important;
    display: flex; flex-direction: column; gap: .375rem;
}
.card-header.d-flex { flex-direction: row !important; }
.card-title, .card-header h5, .card-header h6 {
    font-size: 1.5rem; font-weight: 600;
    line-height: 1; letter-spacing: -.025em;
    color: hsl(var(--card-foreground)); margin: 0;
}
.card-header h5 { font-size: 1rem; }
.card-header h6 { font-size: .9375rem; }
.card-description, .card-header p {
    font-size: .875rem;
    color: hsl(var(--muted-foreground)); margin: 0;
}
.card-body { padding: 1rem !important; }
.card-footer {
    background: transparent !important;
    border-top: 1px solid hsl(var(--border)) !important;
    padding: 1rem !important;
    display: flex; align-items: center;
}

@media (min-width: 768px) {
    .card-header { padding: 1.5rem !important; }
    .card-body   { padding: 1.5rem !important; }
    .card-footer { padding: 1.5rem !important; }
}

.hover-scale { transition: transform .2s cubic-bezier(.4,0,.2,1); }
.hover-scale:hover { transform: scale(1.05); }
.shadow-shopcode { box-shadow: var(--shadow-shopcode) !important; }
.shadow-elegant  { box-shadow: var(--shadow-elegant) !important; }
.bg-gradient-subtle { background-image: var(--gradient-subtle) !important; border: 0 !important; }

/* ── Stat karty ─────────────────────────────────────────── */
.stat-card {
    background-image: var(--gradient-subtle);
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-shopcode);
    transition: transform .2s, box-shadow .2s;
    display: flex; flex-direction: column; gap: .4rem;
    text-decoration: none; color: inherit;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elegant) !important;
    text-decoration: none; color: hsl(var(--foreground));
}
.stat-icon {
    width: 2.25rem; height: 2.25rem;
    border-radius: calc(var(--radius) - 2px);
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.stat-value { font-size: 1.375rem; font-weight: 700; line-height: 1; color: hsl(var(--foreground)); }
.stat-label { font-size: .8rem; color: hsl(var(--muted-foreground)); }
.stat-change { font-size: .75rem; display: flex; align-items: center; gap: .25rem; }

@media (min-width: 768px) {
    .stat-card { padding: 1.25rem; }
    .stat-value { font-size: 1.5rem; }
    .stat-label { font-size: .875rem; }
}

/* ══════════════════════════════════════════════════════════
   TABULKY
   ══════════════════════════════════════════════════════════ */

.table {
    color: hsl(var(--foreground)) !important;
    --bs-table-bg: transparent;
    --bs-table-hover-bg: hsl(var(--muted));
    caption-side: bottom;
    border-collapse: collapse;
    width: 100%;
}
.table th {
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
    color: hsl(var(--muted-foreground));
    border-bottom: 1px solid hsl(var(--border)) !important;
    padding: .625rem .75rem;
    white-space: nowrap;
}
.table td {
    border-bottom: 1px solid hsl(var(--border)) !important;
    padding: .75rem .75rem; vertical-align: middle;
    color: hsl(var(--foreground));
    font-size: .875rem;
}
.table tbody tr:last-child td { border-bottom: 0 !important; }
.table tbody tr:hover td { background-color: hsl(var(--muted)); }

/* Scroll shadow — naznačuje scrollovatelnost */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .table th { font-size: .75rem; padding: .75rem 1rem; }
    .table td { padding: .875rem 1rem; }
}

/* ══════════════════════════════════════════════════════════
   FORMULÁŘE
   ══════════════════════════════════════════════════════════ */

.form-control, .form-select {
    height: 48px;
    border-radius: calc(var(--radius) - 2px) !important;
    border: 1px solid hsl(var(--input)) !important;
    background-color: hsl(var(--background)) !important;
    color: hsl(var(--foreground)) !important;
    padding: .5rem .75rem;
    font-size: 16px !important; /* Zabrání iOS auto-zoom */
    font-family: inherit;
    line-height: 1.5;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    outline: none !important;
    border-color: hsl(var(--primary)) !important;
    background-color: hsl(var(--background)) !important;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring) / .5) !important;
}
textarea.form-control { height: auto; min-height: 5rem; }
.form-control::placeholder { color: hsl(var(--muted-foreground)) !important; opacity: 1; }
.form-control[readonly], .form-control:disabled {
    background-color: hsl(var(--muted)) !important;
    color: hsl(var(--muted-foreground)) !important;
    cursor: not-allowed; opacity: .5;
}
.input-group-text {
    background-color: hsl(var(--muted)) !important;
    border: 1px solid hsl(var(--input)) !important;
    border-radius: calc(var(--radius) - 2px) !important;
    color: hsl(var(--muted-foreground));
    font-size: .875rem; padding: .5rem .75rem;
    height: 48px;
}
.form-label { font-size: .875rem; font-weight: 500; color: hsl(var(--foreground)); margin-bottom: .375rem; }
.form-text { font-size: .75rem; color: hsl(var(--muted-foreground)); margin-top: .25rem; }
.form-check-input:checked { background-color: hsl(var(--primary)) !important; border-color: hsl(var(--primary)) !important; }
.form-check-input:focus { box-shadow: 0 0 0 2px hsl(var(--ring) / .5) !important; }

@media (min-width: 768px) {
    .form-control, .form-select { height: 2.5rem; font-size: .875rem !important; }
    .input-group-text { height: 2.5rem; }
}

/* ══════════════════════════════════════════════════════════
   TLAČÍTKA
   ══════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    border-radius: calc(var(--radius) - 2px) !important;
    font-size: .875rem !important; font-weight: 500 !important;
    min-height: 44px;
    padding: .5rem 1rem !important;
    line-height: 1;
    transition: background-color .15s, opacity .15s, transform .1s;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { pointer-events: none; opacity: .5; }

@media (min-width: 768px) {
    .btn { min-height: 2.5rem; }
}

.btn-primary {
    background-color: hsl(var(--primary)) !important;
    background-image: var(--gradient-primary) !important;
    border: 0 !important;
    color: hsl(var(--primary-foreground)) !important;
    box-shadow: var(--shadow-shopcode);
}
.btn-primary:hover { opacity: .9 !important; }

.btn-outline-secondary {
    background-color: hsl(var(--background)) !important;
    border: 1px solid hsl(var(--input)) !important;
    color: hsl(var(--foreground)) !important;
}
.btn-outline-secondary:hover {
    background-color: hsl(var(--accent)) !important;
    color: hsl(var(--accent-foreground)) !important;
}

.btn-outline-primary {
    background-color: hsl(var(--background)) !important;
    border: 1px solid hsl(var(--primary)) !important;
    color: hsl(var(--primary)) !important;
}
.btn-outline-primary:hover {
    background-color: hsl(var(--primary)) !important;
    color: hsl(var(--primary-foreground)) !important;
}

.btn-outline-success {
    background-color: hsl(var(--background)) !important;
    border: 1px solid #16a34a !important;
    color: #16a34a !important;
}
.btn-outline-success:hover {
    background-color: #16a34a !important;
    color: #fff !important;
}

.btn-outline-danger {
    background-color: hsl(var(--background)) !important;
    border: 1px solid hsl(var(--destructive)) !important;
    color: hsl(var(--destructive)) !important;
}
.btn-outline-danger:hover {
    background-color: hsl(var(--destructive)) !important;
    color: hsl(var(--destructive-foreground)) !important;
}

.btn-outline-info {
    background-color: hsl(var(--background)) !important;
    border: 1px solid #0891b2 !important;
    color: #0891b2 !important;
}
.btn-outline-info:hover {
    background-color: #0891b2 !important;
    color: #fff !important;
}

.btn-outline-warning {
    background-color: hsl(var(--background)) !important;
    border: 1px solid #d97706 !important;
    color: #d97706 !important;
}
.btn-outline-warning:hover {
    background-color: #d97706 !important;
    color: #fff !important;
}

.btn-danger {
    background-color: hsl(var(--destructive)) !important;
    border: 0 !important;
    color: hsl(var(--destructive-foreground)) !important;
}
.btn-danger:hover { opacity: .9 !important; }

.btn-secondary {
    background-color: hsl(var(--secondary)) !important;
    border: 0 !important;
    color: hsl(var(--secondary-foreground)) !important;
}
.btn-secondary:hover { background-color: hsl(var(--secondary) / .8) !important; }

.btn-ghost {
    background: transparent !important; border: 0 !important;
    color: hsl(var(--foreground)) !important;
}
.btn-ghost:hover { background-color: hsl(var(--accent)) !important; color: hsl(var(--accent-foreground)) !important; }

.btn-sm { min-height: 36px !important; padding: .375rem .75rem !important; font-size: .8125rem !important; }
.btn-lg { min-height: 52px !important; padding: .5rem 2rem !important; }
.btn-xs { min-height: 28px !important; padding: .2rem .5rem !important; font-size: .75rem !important; }

@media (min-width: 768px) {
    .btn-sm { min-height: 2.25rem !important; }
    .btn-lg { min-height: 2.75rem !important; }
}

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex; align-items: center;
    border-radius: 9999px !important;
    border: 1px solid transparent;
    padding: .125rem .625rem;
    font-size: .75rem; font-weight: 600; line-height: 1.5;
    transition: background-color .15s;
}
.bg-primary   { background-color: hsl(var(--primary)) !important; color: hsl(var(--primary-foreground)) !important; border-color: transparent !important; }
.bg-secondary { background-color: hsl(var(--secondary)) !important; color: hsl(var(--secondary-foreground)) !important; border-color: transparent !important; }
.bg-success   { background-color: #16a34a !important; color: #fff !important; border-color: transparent !important; }
.bg-warning   { background-color: #d97706 !important; color: #fff !important; border-color: transparent !important; }
.bg-danger    { background-color: hsl(var(--destructive)) !important; color: hsl(var(--destructive-foreground)) !important; border-color: transparent !important; }
.bg-info      { background-color: #0891b2 !important; color: #fff !important; border-color: transparent !important; }

/* ══════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════ */

.alert { border-radius: var(--radius); font-size: .875rem; padding: .875rem 1rem; }
.alert-success  { background: #f0fdf4 !important; border-color: #bbf7d0 !important; color: #166534 !important; }
.alert-danger   { background: #fef2f2 !important; border-color: #fecaca !important; color: #991b1b !important; }
.alert-warning  { background: #fffbeb !important; border-color: #fde68a !important; color: #92400e !important; }
.alert-info     { background: #f0f9ff !important; border-color: #bae6fd !important; color: #075985 !important; }
.btn-close { filter: none !important; opacity: .7; }

/* ══════════════════════════════════════════════════════════
   IMPERSONATION BAR
   ══════════════════════════════════════════════════════════ */

.impersonation-bar {
    background-color: hsl(var(--destructive) / .1);
    border-bottom: 4px solid hsl(var(--destructive)) !important;
    color: hsl(var(--foreground));
    font-size: .8rem; font-weight: 500;
    position: sticky; top: 0; z-index: 200;
    padding: .5rem 1rem;
    display: flex; align-items: center; justify-content: center;
    gap: .5rem; flex-wrap: wrap; text-align: center;
}

/* ══════════════════════════════════════════════════════════
   MODÁLY — Bottom sheet na mobilu
   ══════════════════════════════════════════════════════════ */

.modal-content {
    background-color: hsl(var(--card)) !important;
    color: hsl(var(--foreground)) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 20px 60px rgb(0 0 0 / .12) !important;
}
.modal-header {
    background-color: hsl(var(--card)) !important;
    border-bottom: 1px solid hsl(var(--border)) !important;
    padding: 1.25rem !important;
}
.modal-body {
    background-color: hsl(var(--card)) !important;
    color: hsl(var(--foreground)) !important;
    padding: 1.25rem !important;
}
.modal-footer {
    background-color: hsl(var(--muted)) !important;
    border-top: 1px solid hsl(var(--border)) !important;
    padding: 1.25rem !important;
}
.modal-title { font-size: 1.125rem; font-weight: 600; color: hsl(var(--foreground)) !important; }
.modal-backdrop { background-color: #000 !important; }
.modal-backdrop.show { opacity: .5 !important; }

/* Bottom sheet na mobilu */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100%;
        position: absolute;
        bottom: 0;
        left: 0; right: 0;
    }
    .modal-content {
        border-radius: 20px 20px 0 0 !important;
        border-bottom: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
    }
    /* Bottom sheet handle */
    .modal-header::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        background: hsl(var(--border));
        border-radius: 2px;
        margin: 0 auto .75rem;
    }
    .modal.fade .modal-dialog {
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .modal.show .modal-dialog {
        transform: translateY(0);
    }
}

@media (min-width: 768px) {
    .modal-header { padding: 1.5rem !important; }
    .modal-body   { padding: 1.5rem !important; }
    .modal-footer { padding: 1.5rem !important; }
}

/* ══════════════════════════════════════════════════════════
   DROPDOWN
   ══════════════════════════════════════════════════════════ */

.dropdown-menu {
    background-color: hsl(var(--popover, var(--card))) !important;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1) !important;
    padding: .25rem;
    font-size: .875rem;
}
.dropdown-item {
    border-radius: calc(var(--radius) - 4px);
    color: hsl(var(--foreground));
    padding: .5rem .75rem;
    font-size: .875rem;
    min-height: 40px;
    display: flex;
    align-items: center;
}
.dropdown-item:hover { background-color: hsl(var(--accent)) !important; color: hsl(var(--accent-foreground)); }
.dropdown-item.active, .dropdown-item:active { background-color: hsl(var(--primary)) !important; color: hsl(var(--primary-foreground)); }

/* ══════════════════════════════════════════════════════════
   STRÁNKOVÁNÍ
   ══════════════════════════════════════════════════════════ */

.pagination { gap: .125rem; flex-wrap: wrap; justify-content: center; }
.page-link {
    background-color: hsl(var(--background)) !important;
    border-color: hsl(var(--border)) !important;
    color: hsl(var(--foreground)) !important;
    font-size: .875rem;
    min-height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-link:hover { background-color: hsl(var(--accent)) !important; color: hsl(var(--accent-foreground)) !important; }
.page-item.active .page-link {
    background-color: hsl(var(--primary)) !important;
    border-color: hsl(var(--primary)) !important;
    color: hsl(var(--primary-foreground)) !important;
}

/* ══════════════════════════════════════════════════════════
   PROGRESS
   ══════════════════════════════════════════════════════════ */

.progress { background-color: hsl(var(--secondary)); border-radius: 9999px; height: .5rem; }
.progress-bar { background-image: var(--gradient-primary); }

/* ══════════════════════════════════════════════════════════
   AUTH STRÁNKY
   ══════════════════════════════════════════════════════════ */

.auth-bg {
    min-height: 100vh;
    background-image: var(--gradient-subtle);
    display: flex;
    align-items: flex-end; /* bottom sheet efekt na mobilu */
    justify-content: center;
    padding: 0;
}
.auth-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgb(0 0 0 / .08);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}
.auth-card-header {
    padding: 1.5rem;
    display: flex; flex-direction: column; align-items: center; gap: .375rem;
    border-bottom: 1px solid hsl(var(--border));
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 1rem; }
.auth-logo img { height: 3rem; width: auto; }
.auth-title {
    font-size: 1.5rem; font-weight: 700;
    color: hsl(var(--primary));
    text-align: center; margin: 0;
}
.auth-subtitle {
    font-size: .875rem; color: hsl(var(--muted-foreground));
    text-align: center; margin: 0;
}
.auth-card-body { padding: 1.5rem; }

/* Handle na auth card */
.auth-card::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: hsl(var(--border));
    border-radius: 2px;
    margin: .875rem auto .25rem;
}

@media (min-width: 768px) {
    .auth-bg {
        align-items: center;
        padding: 1rem;
    }
    .auth-card {
        border-radius: var(--radius);
        max-width: 28rem;
        box-shadow: var(--shadow-shopcode);
    }
    .auth-card::before { display: none; }
}

/* ══════════════════════════════════════════════════════════
   ANIMACE
   ══════════════════════════════════════════════════════════ */

@keyframes fade-in {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fade-in .25s ease-out; }

@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

/* ══════════════════════════════════════════════════════════
   TEXT & UTILITY
   ══════════════════════════════════════════════════════════ */

.text-primary     { color: hsl(var(--primary)) !important; }
.text-muted       { color: hsl(var(--muted-foreground)) !important; }
.text-success     { color: #16a34a !important; }
.text-danger      { color: hsl(var(--destructive)) !important; }
.text-warning     { color: #d97706 !important; }
.text-foreground  { color: hsl(var(--foreground)) !important; }

.gradient-text {
    background-image: var(--gradient-primary);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}

code, .font-monospace {
    font-family: ui-monospace, 'Courier New', monospace;
    font-size: .85em; background-color: hsl(var(--muted));
    padding: .1em .35em; border-radius: .25rem;
    color: hsl(var(--primary));
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / .4); }

/* ══════════════════════════════════════════════════════════
   ADMIN SIDEBAR
   ══════════════════════════════════════════════════════════ */

.admin-sidebar .sidebar-nav .nav-link.active {
    background-color: hsl(var(--primary) / .1);
    color: hsl(var(--primary)); font-weight: 500;
}

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT PADDING
   ══════════════════════════════════════════════════════════ */

main.p-4 { padding: 1rem !important; }

@media (min-width: 768px) {
    main.p-4 { padding: 1.5rem !important; }
}

/* === Mobilní overflow fix === */
main {
    overflow-x: hidden;
    min-width: 0;
    max-width: 100%;
    word-break: break-word;
}

/* Tabulky na mobilu vždy scrollovatelné */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Dlouhé URL a texty — nezpůsobují overflow */
pre, code, .font-monospace {
    overflow-x: auto;
    max-width: 100%;
    word-break: break-all;
}

/* Fix pro row uvnitř card — nezpůsobuje horizontální scroll */
.card .row {
    --bs-gutter-x: 1rem;
    margin-left: calc(var(--bs-gutter-x) * -0.5);
    margin-right: calc(var(--bs-gutter-x) * -0.5);
}

/* === Kritické opravy mobilního overflow === */
/* Bootstrap row negativní marginy přetékají z wrapperu */
#page-content {
    overflow-x: hidden;
}
#page-content .row {
    margin-left: 0;
    margin-right: 0;
}
#page-content main {
    overflow-x: hidden;
}
/* Tabulky — vždy scrollovatelné, ne přetékající */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
}
/* Dlouhé texty, URL, kódy */
td, th {
    max-width: 0; /* nutí buňky dodržovat šířku tabulky */
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Výjimka — td bez ořezu */
td.td-no-truncate {
    max-width: none;
    overflow: visible;
}
