/* style_admin.css - Dark modern admin panel v souladu s hlavním stylem */

:root {
    --bg: #1a1a1a;
    --bg-elevated: #2a2a2a;
    --bg-soft: #3a3a3a;
    --panel: rgba(42,42,42,0.95);
    --panel-strong: #242424;
    --accent: #b8a600;
    --accent-soft: rgba(184,166,0,0.15);
    --accent-strong: #cc9828;
    --text: #f5f5f5;
    --text-soft: #a8a8a8;
    --danger: #dc3545;
    --success: #28a745;
    --border-subtle: rgba(255,255,255,0.12);
    --radius: 10px;
    --shadow-soft: 0 8px 25px rgba(0,0,0,0.4);
    --shadow-card: 0 4px 16px rgba(0,0,0,0.3);
    --transition: all 0.3s ease;
    --sidebar-width: 282px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-elevated) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Sidebar admin layout */

.admin-body {
    background:
        radial-gradient(circle at top left, rgba(184,166,0,0.08), transparent 32rem),
        linear-gradient(135deg, #1d1d1d 0%, #242424 100%);
}

.admin-shell {
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--sidebar-width);
    padding: 1.15rem;
    background: #151515;
    border-right: 1px solid rgba(255,255,255,0.1);
    box-shadow: 12px 0 34px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 62px;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
}

.sidebar-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #111;
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(184,166,0,0.22);
}

.sidebar-title {
    display: block;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand span {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.sidebar-nav {
    display: grid;
    gap: 0.4rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 46px;
    padding: 0.75rem 0.85rem;
    border-radius: 9px;
    color: var(--text-soft);
    text-decoration: none;
    border: 1px solid transparent;
    transition: var(--transition);
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--text);
    background: rgba(184,166,0,0.12);
    border-color: rgba(184,166,0,0.32);
}

.sidebar-link.active {
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-link-text {
    font-weight: 600;
}

.sidebar-badge {
    min-width: 28px;
    height: 24px;
    padding: 0 0.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111;
    background: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    display: grid;
    gap: 0.55rem;
}

.sidebar-secondary-link {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--text-soft);
    text-decoration: none;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    transition: var(--transition);
}

.sidebar-secondary-link:hover {
    color: var(--text);
    border-color: var(--border-subtle);
}

.sidebar-logout .btn {
    width: 100%;
}

.admin-page {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.admin-main {
    min-height: 100vh;
    padding: 1.6rem;
}

.admin-content {
    max-width: 1340px;
    margin: 0 auto;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
    padding: 1.05rem 1.15rem;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(31,31,31,0.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.22);
}

.admin-topbar h2 {
    margin: 0;
    text-align: left;
    font-size: 1.55rem;
    line-height: 1.2;
}

.page-kicker {
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-body .main {
    padding: 0;
}

.admin-body section h3,
.admin-body h3 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}

.admin-body .order-card[style] {
    border-color: var(--border-subtle) !important;
    background: rgba(42,42,42,0.95);
}

.admin-body .empty-admin-state,
.admin-body > p,
.orders-panel > p {
    padding: 1.4rem;
    border: 1px dashed var(--border-subtle);
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    color: var(--text-soft);
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(26,26,26,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 68px;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
}

.logo a {
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    font-size: 1.15rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    position: relative;
    color: var(--text-soft);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 0;
    transition: var(--transition);
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: var(--accent-strong);
    border-radius: 2px;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Main */
.main {
    min-height: calc(100vh - 116px);
    padding: 2rem 0 3rem;
}

.main h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: 700;
}

/* Login Form */
.login-form {
    max-width: 420px;
    margin: 0 auto 2rem;
    padding: 2.5rem;
    background: rgba(42,42,42,0.95);
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
}

.login-form h3 {
    text-align: center;
    margin-bottom: 1.8rem;
    font-size: 1.4rem;
    font-weight: 600;
}

/* Admin Header */
.admin-header {
    background: rgba(42,42,42,0.95);
    border-radius: var(--radius);
    padding: 1.8rem 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-tab {
    padding: 0.8rem 1.4rem;
    background: rgba(58,58,58,0.7);
    color: var(--text-soft);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

.admin-tab:hover,
.admin-tab.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.92rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.9rem 1rem;
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: rgba(42,42,42,0.95);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox-field {
    padding: 0.95rem 1rem;
    background: rgba(255,255,255,0.035);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.35rem;
    cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.checkbox-field p {
    color: var(--text-soft);
    font-size: 0.86rem;
    line-height: 1.45;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    color: #111;
    box-shadow: 0 4px 12px rgba(184,166,0,0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(184,166,0,0.4);
}

.btn-secondary {
    background: rgba(58,58,58,0.8);
    color: var(--text);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: rgba(58,58,58,1);
    border-color: var(--accent);
}

.btn-danger {
    background: rgba(220,53,69,0.9);
    color: white;
    border: 1px solid rgba(220,53,69,0.3);
}

.btn-danger:hover {
    background: rgba(220,53,69,1);
    box-shadow: 0 4px 12px rgba(220,53,69,0.4);
}

.btn-success {
    background: rgba(40,167,69,0.9);
    color: white;
    border: 1px solid rgba(40,167,69,0.3);
}

.btn-success:hover {
    background: rgba(40,167,69,1);
    box-shadow: 0 4px 12px rgba(40,167,69,0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.category-form-row {
    align-items: end;
}

.category-submit-group {
    margin-bottom: 1.5rem;
}

.inline-category-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.category-table input {
    width: 100%;
    min-width: 180px;
    padding: 0.65rem 0.75rem;
    background: var(--bg-soft);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text);
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Alerts */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(40,167,69,0.15);
    color: var(--success);
    border: 1px solid rgba(40,167,69,0.3);
}

.alert-error {
    background: rgba(220,53,69,0.15);
    color: var(--danger);
    border: 1px solid rgba(220,53,69,0.3);
}

/* Tables */
.products-table {
    width: 100%;
    background: var(--panel);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
}

.products-table thead {
    background: rgba(255,255,255,0.045);
}

.products-table th,
.products-table td {
    padding: 1.2rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.products-table th {
    font-weight: 600;
    color: var(--text-soft);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.products-table tbody tr {
    transition: var(--transition);
}

.products-table tbody tr:hover {
    background: rgba(184,166,0,0.08);
}

/* Order Cards & Sidebar */
.orders-layout {
    display: grid;
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
}

.orders-panel {
    min-width: 0;
}

.email-filter-panel {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(24,24,24,0.92);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

.email-filter-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
}

.email-filter-head h4 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
}

.email-filter-head span {
    color: var(--text-soft);
    font-size: 0.78rem;
    white-space: nowrap;
}

.email-list {
    list-style: none;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.75rem 0.35rem 0.75rem 0;
    margin: 0;
}

.email-list li + li {
    margin-top: 0.35rem;
}

.email-list a {
    display: block;
    padding: 0.65rem 0.75rem;
    color: var(--text-soft);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: var(--transition);
}

.email-list a:hover,
.email-list a.active {
    background: var(--accent-soft);
    border-color: rgba(184,166,0,0.28);
    color: var(--accent-strong);
}

.email-filter-actions {
    display: grid;
    gap: 0.55rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-subtle);
}

.email-filter-actions .btn {
    width: 100%;
}

.email-list::-webkit-scrollbar {
    width: 8px;
}

.email-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.04);
    border-radius: 999px;
}

.email-list::-webkit-scrollbar-thumb {
    background: rgba(184,166,0,0.45);
    border-radius: 999px;
}

.order-card,
.user-order-card {
    background: var(--panel);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    padding: 1.1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.order-card:hover {
    border-color: rgba(184,166,0,0.32);
    box-shadow: 0 10px 28px rgba(0,0,0,0.34);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: -1.1rem -1.1rem 1rem;
    padding: 0.9rem 1.1rem;
    background: rgba(255,255,255,0.035);
    border-bottom: 1px solid var(--border-subtle);
}

.order-card-header strong {
    color: var(--accent-strong);
    font-size: 1rem;
}

.order-card-header span {
    color: var(--text-soft);
    font-size: 0.86rem;
}

.order-card p {
    margin: 0.35rem 0;
    color: var(--text-soft);
}

.order-card p strong {
    color: var(--text);
}

aside:not(.email-filter-panel) {
    width: max-content;
    background: rgba(42,42,42,0.9);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

aside:not(.email-filter-panel) h4 {
    margin-bottom: 1.2rem;
    color: var(--text);
    font-size: 1rem;
}

aside:not(.email-filter-panel) ul {
    list-style: none;
}

aside:not(.email-filter-panel) ul li {
    margin-bottom: 0.3rem;
}

aside:not(.email-filter-panel) ul li a {
    display: block;
    padding: 0.7rem 1rem;
    color: var(--text-soft);
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
}

aside:not(.email-filter-panel) ul li a:hover,
aside:not(.email-filter-panel) ul li a.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.order-card ul {
    margin: 1rem 0;
    padding: 0.85rem 1rem 0.85rem 1.35rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.035);
    border: 1px solid var(--border-subtle);
}

.order-card ul li {
    padding: 0.4rem 0;
    color: var(--text-soft);
}

.order-card strong {
    color: var(--text);
}

.order-card select {
    min-height: 38px;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-soft);
    color: var(--text);
}

.order-card form {
    margin-top: 0.75rem;
}

.paid-label {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(40,167,69,0.15);
    border: 1px solid rgba(40,167,69,0.3);
    color: var(--success);
    font-weight: 700;
    font-size: 0.85rem;
}

section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

/* Flex layout for orders/archive */
div[style*="display:flex;gap:2rem"] {
    display: flex !important;
    gap: 2rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .admin-sidebar {
        position: static;
        width: auto;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: 0 12px 30px rgba(0,0,0,0.24);
    }

    .admin-page {
        margin-left: 0;
    }

    .sidebar-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sidebar-footer {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: center;
    }

    div[style*="display:flex;gap:2rem"] {
        flex-direction: column;
    }
    
    aside:not(.email-filter-panel) {
        width: 100%;
        order: 2;
    }

    .orders-layout {
        grid-template-columns: 1fr;
    }

    .email-filter-panel {
        position: static;
        max-height: none;
    }

    .email-list {
        max-height: 260px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 18px;
    }
    
    .header .container {
        height: auto;
        padding: 1rem 18px;
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        flex-direction: column;
        text-align: center;
    }

    .admin-main {
        padding: 1rem;
    }

    .admin-topbar {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .sidebar-nav,
    .sidebar-footer {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .products-table {
        font-size: 0.9rem;
    }
    
    .products-table th,
    .products-table td {
        padding: 0.8rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .login-form,
    .admin-form {
        margin: 0 1rem;
        padding: 1.8rem;
    }
    
    .products-table {
        overflow-x: auto;
        display: block;
    }
}

/* Admin Form */
.admin-form {
    background: rgba(42,42,42,0.95);
    border-radius: var(--radius);
    padding: 2.5rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-soft);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main > * {
    animation: fadeInUp 0.5s ease-out;
}
