/* --- LAYOUT A SIDEBAR --- */
.admin-wrapper { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background-color: #f4f6f8; }
.admin-sidebar { background: white; border-right: 1px solid #eaeaea; padding: 2.5rem 1.5rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 10; }
.admin-profile { display: flex; align-items: center; gap: 15px; margin-bottom: 3rem; padding-bottom: 1.5rem; border-bottom: 1px solid #f0f0f0; }
.avatar-circle { width: 45px; height: 45px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-heading); font-size: 1.2rem; }
.admin-info strong { display: block; font-size: 0.9rem; color: var(--primary); }
.admin-info span { font-size: 0.7rem; color: #999; text-transform: uppercase; letter-spacing: 1px; }
.admin-nav-links a { display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: var(--secondary); border-radius: 8px; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; transition: all 0.2s ease; }
.admin-nav-links a:hover { background: #f9f9f9; color: var(--primary); transform: translateX(3px); }
.admin-nav-links a.active { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.view-site { margin-top: auto; color: var(--tertiary) !important; border: 1px dashed #ddd; justify-content: center; }
.view-site:hover { border-color: var(--primary); background: transparent !important; }

.admin-content { padding: 4rem; max-width: 1600px; margin: 0 auto; width: 100%; }
.admin-header { margin-bottom: 3rem; display: flex; justify-content: space-between; align-items: flex-end; }
.admin-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; letter-spacing: -1px; }
.admin-header p { color: #888; font-size: 1rem; }

.admin-card { background: white; border-radius: 12px; box-shadow: 0 2px 20px rgba(0,0,0,0.04); border: 1px solid #eaeaea; overflow: hidden; margin-bottom: 2rem; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 1.5rem; background: #fff; font-size: 0.7rem; text-transform: uppercase; color: #999; letter-spacing: 1.5px; border-bottom: 2px solid #f0f0f0; }
.admin-table td { padding: 1.2rem 1.5rem; border-bottom: 1px solid #f5f5f5; vertical-align: middle; color: var(--primary); }
.admin-thumb { width: 50px; height: 50px; border-radius: 8px; overflow: hidden; border: 1px solid #eee; background: #fafafa; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 3rem; }
.stat-card { background: white; padding: 1.8rem; border-radius: 12px; border: 1px solid #eaeaea; display: flex; align-items: center; gap: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); transition: transform 0.3s; }
.stat-card:hover { transform: translateY(-5px); }
.stat-card.highlight { border-bottom: 4px solid var(--warning); }
.stat-icon { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-label { font-size: 0.7rem; text-transform: uppercase; color: #999; letter-spacing: 1.5px; font-weight: 700; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); font-family: var(--font-heading); margin-top: 5px; }

.form-card { background: white; padding: 3.5rem; border-radius: 16px; box-shadow: 0 5px 30px rgba(0,0,0,0.05); border: 1px solid #eaeaea; }
.form-grid { display: grid; grid-template-columns: 1.8fr 1fr; gap: 5rem; align-items: start; }
.form-group { margin-bottom: 2rem; position: relative; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: #4a4a4a; margin-bottom: 10px; letter-spacing: 1px; }
.form-group input[type="text"], .form-group input[type="number"], .form-group select, .form-group textarea { width: 100%; padding: 16px 20px; border: 1px solid transparent; background-color: #f7f7f7; border-radius: 8px; font-size: 1rem; color: var(--primary); transition: all 0.3s; font-family: inherit; }
.form-group input:hover, .form-group select:hover, .form-group textarea:hover { background-color: #f0f0f0; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { background-color: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0,0,0,0.05); outline: none; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.img-preview-box { width: 100%; height: 300px; background: #fafafa; border-radius: 12px; margin-top: 10px; display: flex; align-items: center; justify-content: center; border: 2px dashed #ddd; overflow: hidden; position: relative; transition: 0.3s; }
.img-preview-box:hover { border-color: #aaa; }
.img-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.toggle-group { background: white; padding: 2rem; border-radius: 12px; border: 1px solid #eaeaea; margin-top: 2.5rem; box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
.checkbox-container { display: flex; align-items: flex-start; gap: 15px; cursor: pointer; margin-bottom: 20px; padding: 10px; border-radius: 8px; transition: 0.2s; }
.checkbox-container:hover { background-color: #f9f9f9; }
.checkbox-container input { appearance: none; width: 22px; height: 22px; border: 2px solid #ccc; border-radius: 5px; margin-top: 3px; flex-shrink: 0; cursor: pointer; position: relative; transition: 0.2s; background: white; }
.checkbox-container input:checked { background-color: var(--primary); border-color: var(--primary); }
.checkbox-container input:checked::after { content: '✓'; position: absolute; color: white; font-size: 14px; font-weight: bold; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.sub-text { display: block; font-size: 0.8rem; color: #888; font-weight: 400; margin-top: 4px; }
.form-actions { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid #eaeaea; text-align: right; }
.btn-save { background: var(--primary); color: white; border: none; padding: 16px 45px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; cursor: pointer; border-radius: 50px; transition: 0.3s; box-shadow: 0 5px 20px rgba(0,0,0,0.2); }
.btn-save:hover { background: #333; transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
.btn-back { width: 45px; height: 45px; border-radius: 50%; background: white; border: 1px solid #eaeaea; display: flex; align-items: center; justify-content: center; color: var(--primary); transition: 0.3s; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.btn-back:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateX(-3px); }

.stock-ok { color: #2ecc71; font-weight: 700; background: #e8f5e9; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; }
.stock-low { color: #f39c12; font-weight: 700; background: #fff8e1; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; }
.stock-out { color: #e74c3c; font-weight: 700; background: #ffebeb; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; }
.cat-pill { background: #f0f0f0; padding: 5px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; color: #555; }
.actions-cell { display: flex; justify-content: flex-end; gap: 8px; }
.btn-icon-edit, .btn-icon-delete { width: 35px; height: 35px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; border: 1px solid transparent; }
.btn-icon-edit { background: #f9f9f9; color: var(--primary); }
.btn-icon-edit:hover { background: var(--primary); color: white; }
.btn-icon-delete { background: white; color: #ccc; }
.btn-icon-delete:hover { background: #fff5f5; color: #e74c3c; border-color: #ffebeb; }

.section-label { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; color: #aaa; margin-bottom: 1rem; }
.chart-card { padding: 0; }
.chart-header { display: flex; justify-content: space-between; align-items: center; padding: 1.8rem 2rem 0; flex-wrap: wrap; gap: 1rem; }
.chart-header h3 { font-size: 1.1rem; margin: 0; }
.chart-header p { color: #999; font-size: 0.85rem; margin: 4px 0 0; }
.chart-total-badge { background: #f5f5f5; padding: 8px 18px; border-radius: 50px; font-size: 0.85rem; color: #555; }
.chart-total-badge strong { color: #000; }

.tabs-header { display: flex; gap: 4px; padding: 1.2rem 1.5rem; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }
.tab-link { background: none; border: none; padding: 8px 16px; border-radius: 50px; font-size: 0.8rem; font-weight: 700; cursor: pointer; color: #999; transition: 0.2s; display: flex; align-items: center; gap: 6px; }
.tab-link:hover { background: #f5f5f5; color: #333; }
.tab-link.active { background: #111; color: #fff; }
.tab-count { background: #eee; color: #666; padding: 2px 7px; border-radius: 20px; font-size: 0.7rem; }
.tab-count.new { background: #fff8e1; color: #f39c12; }
.tab-count.paid { background: #e8f5e9; color: #2ecc71; }
.tab-count.shipped { background: #e3f2fd; color: #2196f3; }
.tab-count.cancelled { background: #fce4ec; color: #e74c3c; }

.status-badge { padding: 5px 12px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.status-new { background: #fff8e1; color: #f39c12; }
.status-paid { background: #e8f5e9; color: #27ae60; }
.status-shipped { background: #e3f2fd; color: #2196f3; }
.status-cancelled { background: #fce4ec; color: #e74c3c; }

.details-row td { padding: 0; background: #fafafa; }
.details-content { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2rem; padding: 2rem; border-top: 3px solid #f0f0f0; }
.details-products h5, .details-actions h5 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #aaa; margin: 0 0 1rem; display: flex; align-items: center; gap: 6px; }
.item-list { list-style: none; padding: 0; margin: 0; }
.item-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.item-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #eee; flex-shrink: 0; }
.item-info { flex: 1; }
.item-name { display: block; font-size: 0.9rem; font-weight: 600; }
.item-meta { display: block; font-size: 0.78rem; color: #999; }
.item-total { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.item-list-total { text-align: right; padding: 10px 0 0; font-size: 0.9rem; color: #555; }
.item-list-total strong { color: #000; font-size: 1rem; }
.shipping-info p { font-size: 0.9rem; color: #555; margin: 3px 0; }

.inline-status-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-select-inline { flex: 1; padding: 10px 14px; border: 1px solid #eee; border-radius: 8px; font-size: 0.85rem; background: #fff; cursor: pointer; }
.btn-status-save { background: #111; color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: 0.2s; }
.btn-status-save:hover { background: #333; }
.btn-notify-paid { width: 100%; background: #2ecc71; color: #fff; border: none; padding: 12px 18px; border-radius: 8px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-notify-paid:hover { background: #27ae60; transform: translateY(-1px); }
.btn-expand { background: #f5f5f5; border: none; padding: 8px 14px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; color: #555; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-expand:hover { background: #111; color: #fff; }

.customer-info strong { display: block; font-size: 0.9rem; }
.email-small { font-size: 0.75rem; color: #aaa; }
.order-id { font-weight: 700; color: #555; font-size: 0.85rem; }
.date-box span { display: block; font-size: 0.85rem; }
.date-box small { color: #aaa; font-size: 0.75rem; }

/* =========================================
   MOBILNÍ ADMIN
   ========================================= */
@media (max-width: 1000px) {
    .admin-sidebar { display: none !important; }
    .admin-wrapper { grid-template-columns: 1fr !important; }
    .admin-content { padding: 0 !important; width: 100%; max-width: 100%; }

    .admin-mobile-topbar {
        display: flex !important;
        align-items: center;
        gap: 8px;
        background: #111;
        color: white;
        padding: 12px 14px;
        position: sticky;
        top: 0;
        z-index: 999;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        margin-bottom: 1.5rem;
    }

    .admin-mobile-topbar .topbar-title { font-weight: 800; font-size: 0.95rem; color: white; flex-shrink: 0; }
    .admin-mobile-topbar .topbar-links { display: flex; gap: 6px; flex-shrink: 0; }

    .admin-mobile-topbar .topbar-links a,
    .topbar-back {
        color: white !important;
        background: rgba(255,255,255,0.12) !important;
        padding: 7px 12px !important;
        border-radius: 6px !important;
        font-size: 0.78rem !important;
        font-weight: 600 !important;
        white-space: nowrap;
        flex-shrink: 0;
        transition: 0.2s;
    }
    .admin-mobile-topbar .topbar-links a.active,
    .admin-mobile-topbar .topbar-links a:hover,
    .topbar-back:hover { background: white !important; color: #111 !important; }

    .admin-header { flex-direction: column; align-items: flex-start !important; gap: 1rem; margin: 0 1rem 1.5rem; }
    .admin-header h1 { font-size: 1.6rem; margin-bottom: 0; }
    .admin-header p { font-size: 0.85rem; color: #888; }
    .btn-admin-action { width: 100%; justify-content: center; padding: 14px; }

    .section-label { margin: 0 1rem 0.5rem; }
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 0.6rem !important; margin: 0 1rem 1.5rem !important; }
    .stat-card { padding: 0.9rem !important; flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; }
    .stat-icon { width: 32px !important; height: 32px !important; font-size: 0.9rem !important; }
    .stat-value { font-size: 1.2rem !important; }
    .stat-label { font-size: 0.62rem !important; }

    #chartContainer { display: none !important; }
    .admin-card { margin: 0 1rem 1.5rem; border-radius: 8px; }

    .tabs-header { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap !important; padding: 0.75rem 1rem !important; gap: 6px !important; -webkit-overflow-scrolling: touch; }
    .tab-link { flex-shrink: 0; font-size: 0.75rem !important; padding: 7px 11px !important; }

    #desktopTable { display: none !important; }
    #mobileOrdersList { display: block !important; padding: 0.75rem !important; }

    .form-card { padding: 1rem !important; border-radius: 8px !important; margin: 0 1rem; }
    .form-grid { grid-template-columns: 1fr !important; gap: 0 !important; }
    .form-col-right { order: -1; margin-bottom: 1rem; }
    .img-preview-box { height: 180px !important; margin-bottom: 0.75rem; }
    .form-row-2 { grid-template-columns: 1fr !important; gap: 0 !important; }
    .toggle-group { margin-top: 1rem; padding: 1rem; }
    .form-actions { text-align: center !important; padding: 1.5rem 0 2rem; }
    .btn-save { width: 100% !important; border-radius: 8px !important; }

    .admin-table { display: none !important; }
    .admin-products-mobile { display: block !important; padding: 0.75rem; }
}