/* ============================================
   admin.css — 관리자 대시보드 스타일 (다크 테마)
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0D0D1A;
    --surface: #151525;
    --surface2: #1E1E35;
    --border: #252540;
    --primary: #00D4FF;
    --primary-dim: rgba(0, 212, 255, .15);
    --success: #00E676;
    --success-dim: rgba(0, 230, 118, .12);
    --warning: #FFB300;
    --warning-dim: rgba(255, 179, 0, .12);
    --danger: #FF4757;
    --text-main: #E8E8F0;
    --text-sub: #8888AA;
    --text-dim: #555570;
    --radius: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, .4);
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
}

/* ── 헤더 ── */
.admin-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .4);
}

.admin-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-logo-icon {
    font-size: 36px;
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, .3));
}

.admin-logo h1 {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(90deg, #00D4FF, #0088FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-subtitle {
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 400;
    margin-top: 2px;
}

/* 연결 상태 */
.admin-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    transition: background .5s, box-shadow .5s;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

.status-dot.error {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .4;
    }
}

.status-text {
    font-size: 13px;
    color: var(--text-sub);
}

.btn-sound {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-main);
    transition: background .2s, border-color .2s;
}

.btn-sound:hover {
    background: var(--border);
}

.btn-sound.muted {
    opacity: .4;
}

.btn-clear-done {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-sub);
    cursor: pointer;
    transition: background .2s, color .2s;
}

.btn-clear-done:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* 통계 바 */
.stats-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    gap: 32px;
    border-top: 1px solid var(--border);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    color: var(--text-sub);
    font-weight: 500;
}

/* ── 토스트 ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 320px;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--success);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5), 0 0 20px rgba(0, 230, 118, .1);
    animation: toastIn .35s cubic-bezier(.22, .61, .36, 1);
    transform-origin: top right;
}

.toast.leaving {
    animation: toastOut .3s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: scale(.85) translateX(30px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: scale(.85) translateX(30px);
    }
}

.toast-icon {
    font-size: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 3px;
}

.toast-msg {
    font-size: 13px;
    color: var(--text-sub);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 0 0 0 8px;
}

.toast-close:hover {
    color: var(--text-main);
}

/* ── 메인 ── */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* ── 섹션 ── */
.orders-section {}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 800;
}

.order-count {
    background: var(--primary-dim);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid rgba(0, 212, 255, .25);
}

/* ── 주문 그리드 ── */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 빈 상태 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--text-dim);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: .5;
}

.empty-state p {
    font-size: 15px;
}

/* ── 주문 카드 ── */
.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow);
    animation: cardIn .35s cubic-bezier(.22, .61, .36, 1);
    position: relative;
    overflow: hidden;
}

.order-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--warning);
    border-radius: 4px 0 0 4px;
}

.order-card.completed::before {
    background: var(--success);
}

.order-card.new-order {
    border-color: rgba(0, 230, 118, .3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4), 0 0 20px rgba(0, 230, 118, .08);
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.order-table-badge {
    background: linear-gradient(135deg, #1E1E35, #252540);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}

.order-table-badge strong {
    font-size: 18px;
}

.order-time {
    font-size: 12px;
    color: var(--text-dim);
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--surface2);
    border-radius: 10px;
    padding: 12px;
}

.order-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.order-item-name {
    color: var(--text-main);
    display: flex;
    gap: 6px;
    align-items: center;
}

.order-item-qty {
    color: var(--text-sub);
    font-size: 12px;
}

.order-item-price {
    color: var(--warning);
    font-weight: 700;
    font-size: 13px;
}

.order-card.completed .order-item-price {
    color: var(--success);
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.order-total-label {
    font-size: 12px;
    color: var(--text-sub);
}

.order-total-amount {
    font-size: 18px;
    font-weight: 900;
    color: var(--warning);
}

.order-card.completed .order-total-amount {
    color: var(--success);
}

.order-actions {
    display: flex;
    gap: 8px;
}

.btn-accept,
.btn-complete {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform .2s, opacity .2s;
}

.btn-accept:active,
.btn-complete:active {
    transform: scale(.96);
}

.btn-accept {
    background: var(--warning-dim);
    color: var(--warning);
    border: 1px solid rgba(255, 179, 0, .25);
}

.btn-accept:hover {
    background: var(--warning);
    color: #000;
}

.btn-complete {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, .25);
}

.btn-complete:hover {
    background: var(--success);
    color: #000;
}

.completed-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--success-dim);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, .2);
}

/* ── 반응형 ── */
@media (max-width: 600px) {
    .admin-header-inner {
        padding: 14px 16px;
    }

    .stats-bar {
        padding: 10px 16px;
        gap: 20px;
    }

    .admin-main {
        padding: 20px 16px;
    }

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

    .toast-container {
        width: calc(100vw - 32px);
        right: 16px;
    }
}