/* Shared Admin Panel shell — keep nav + main dimensions consistent across pages */

.admin-shell {
    --admin-header-offset: 5.5rem;
    --admin-page-gap: 0.5rem;
    padding: 0 0 var(--admin-page-gap);
    background: #f3f4f6;
    box-sizing: border-box;
}

.admin-shell.main-content {
    padding-top: calc(var(--admin-header-offset) + var(--admin-page-gap));
}

.admin-layout {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: 1fr;
    gap: 1rem;
    align-items: stretch;
    min-height: calc(100vh - var(--admin-header-offset) - (2 * var(--admin-page-gap)));
    box-sizing: border-box;
}

/* Alerts live inside .admin-main so all pages share the same top spacing */
.admin-alerts-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.admin-alerts-wrap:empty {
    display: none;
    margin-bottom: 0;
}

.admin-alerts-wrap .alert {
    margin-bottom: 0;
}

.admin-nav {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 0;
    min-width: 220px;
    max-width: 220px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
}

.admin-main {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
}

.admin-nav-header {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.admin-nav-header h1 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.3;
    font-weight: 600;
}

.admin-nav-menu {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.nav-item {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.35rem;
    cursor: pointer;
    font-size: 0.92rem;
    color: #374151;
    box-sizing: border-box;
}

.nav-item:hover {
    background: #f3f4f6;
}

.nav-item.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

.nav-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nav-link-item {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

span.nav-item.active {
    cursor: default;
}

.admin-nav-footer {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.admin-nav-footer .nav-link {
    font-size: 0.85rem;
    color: #2563eb;
    text-decoration: none;
}

.admin-nav-footer .nav-link:hover {
    text-decoration: underline;
}

.admin-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    width: 100%;
}

.admin-panel.active {
    display: flex;
    overflow: hidden;
}

.admin-panel--static {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.panel-header h1 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.3;
    font-weight: 600;
}

.table-wrap {
    flex: 1;
    min-height: 12rem;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.data-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #f9fafb;
    color: #4b5563;
    font-weight: 600;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tr.active-row {
    background: #eff6ff;
}

.pagination-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
    flex-shrink: 0;
}

.pagination-bar .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.48rem 0.75rem;
    cursor: pointer;
    font-size: 0.88rem;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-light {
    background: #fff;
    border-color: #d1d5db;
    color: #1f2937;
}

.alert {
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #166534;
}

.muted {
    color: #6b7280;
}

.empty-hint {
    margin: 1.5rem 0;
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-completed {
    background: #ecfdf5;
    color: #16a34a;
}

.status-pending {
    background: #fff7ed;
    color: #c2410c;
}

.status-cancelled {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-link:hover {
    text-decoration: underline;
}

@media (max-width: 960px) {
    .admin-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        min-height: 0;
    }

    .admin-nav,
    .admin-main {
        grid-column: 1;
        grid-row: auto;
        max-width: none;
        min-width: 0;
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .admin-nav-header {
        width: 100%;
    }

    .admin-nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }

    .admin-nav-footer {
        width: 100%;
        margin-top: 0.5rem;
    }

    .nav-item {
        width: auto;
        margin: 0;
    }
}
