/**
 * Formula 3D Print Shop - Styles
 */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Playfair+Display:wght@700&display=swap');

:root {
    --bg: #0f0f13;
    --bg-card: #1a1a24;
    --bg-card-hover: #222233;
    --bg-modal: #16161f;
    --border: #2a2a3a;
    --gold: #d4a843;
    --gold-dim: #a07d2e;
    --gold-glow: rgba(212, 168, 67, 0.15);
    --text: #e8e6e1;
    --text-dim: #8a8a9a;
    --text-muted: #555566;
    --accent: #5b8df0;
    --green: #4caf50;
    --red: #e05555;
    --orange: #e89b3e;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ========== ADMIN LOGIN PAGE ========== */

.login-body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.balance-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.back-link {
    display: inline-block;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s;
}

.back-link:hover { color: #fff; }

.balance-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
}

.balance-icon { font-size: 3rem; margin-bottom: 0.5rem; color: var(--gold); }

.balance-card h2 {
    font-family: 'Playfair Display', serif;
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.balance-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    text-align: center;
    transition: border-color 0.2s;
}

.balance-input:focus {
    outline: none;
    border-color: var(--gold);
}

.error-msg {
    background: rgba(224,85,85,0.15);
    border: 1px solid var(--red);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    color: var(--red);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ========== HEADER ========== */

.shop-header {
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #141420 0%, var(--bg) 100%);
    padding: 0;
}

.shop-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.shop-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--gold);
    white-space: nowrap;
}

.shop-logo a { color: inherit; text-decoration: none; }
.shop-logo .logo-icon { margin-right: 0.3em; font-style: normal; }

.shop-user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.user-balance {
    background: var(--gold-glow);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
}

.user-balance small { font-weight: 400; opacity: 0.7; }

.admin-badge {
    background: rgba(224,85,85,0.15) !important;
    border-color: var(--red) !important;
    color: var(--red) !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.05em;
}

.logout-btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
    line-height: 1;
}

.logout-btn:hover { color: var(--red) !important; border-color: var(--red) !important; }

.shop-nav {
    display: flex;
    gap: 0;
    padding: 0 1.2rem;
    overflow-x: auto;
}

.shop-nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.shop-nav a:hover { color: var(--text); }

.shop-nav a.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* ========== ITEM GRID ========== */

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.shop-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.shop-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold-dim);
    box-shadow: 0 8px 32px rgba(212, 168, 67, 0.1);
}

.shop-card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #111118;
    display: block;
}

.shop-card-img.placeholder,
.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
    background: #111118;
}

.shop-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.shop-card-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; }

.shop-card-price {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--gold);
    margin-bottom: 0.8rem;
}

.shop-card-price .unit { font-size: 0.8rem; color: var(--text-dim); font-family: 'Nunito', sans-serif; }

.shop-card-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 0.8rem;
}

.shop-card-link:hover { text-decoration: underline; }

/* ========== BUTTONS ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    color: #111;
    margin-top: auto;
}

.btn-gold:hover:not(:disabled) { filter: brightness(1.15); transform: scale(1.02); }

.btn-block { width: 100%; margin-top: 0.5rem; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.btn-outline:hover { border-color: var(--gold-dim); color: var(--gold); }

.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(1.15); }

.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { filter: brightness(1.15); }

.btn-blue { background: var(--accent); color: #fff; }
.btn-orange { background: var(--orange); color: #111; }

/* ========== MODAL ========== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow);
}

.modal h2 {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

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

.modal-price { color: var(--gold); font-size: 1.1rem; margin-bottom: 0.5rem; }
.modal-balance { color: var(--text-dim); margin-bottom: 1rem; }

/* ========== FORMS ========== */

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold-dim);
}

/* ========== ADMIN ========== */

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.add-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.add-form h2 {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.add-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    text-align: left;
    padding: 0.7rem 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tr:hover { background: var(--bg-card); }

.admin-table .thumb,
.thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
}

.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.dim { color: var(--text-muted); }
.small { font-size: 0.8rem; }
.gold { color: var(--gold); font-weight: 700; }

.status-select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    font-family: 'Nunito', sans-serif;
}

/* ========== BADGES ========== */

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-new { background: var(--accent); color: #fff; }
.badge-accepted { background: var(--orange); color: #111; }
.badge-in_progress { background: #9c6fde; color: #fff; }
.badge-ready { background: var(--green); color: #fff; }
.badge-finished { background: var(--text-muted); color: var(--bg); }
.badge-cancelled { background: var(--red); color: #fff; }

.paid-yes { color: var(--green); font-weight: 700; }
.paid-no { color: var(--red); font-weight: 700; }

/* ========== STATUS ROW BACKGROUNDS ========== */

.status-row-new { background: rgba(91, 141, 240, 0.08); }
.status-row-accepted { background: rgba(232, 155, 62, 0.08); }
.status-row-in_progress { background: rgba(156, 111, 222, 0.08); }
.status-row-ready { background: rgba(76, 175, 80, 0.1); }
.status-row-finished { background: rgba(85, 85, 102, 0.08); opacity: 0.6; }
.status-row-cancelled { background: rgba(224, 85, 85, 0.06); opacity: 0.5; }

/* ========== STATUS FILTER PILLS ========== */

.status-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.status-pill {
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-family: 'Nunito', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.status-pill:hover { border-color: var(--text-muted); color: var(--text); }
.status-pill.active { background: var(--gold-glow); border-color: var(--gold-dim); color: var(--gold); }

.status-pill.badge-new.active { background: rgba(91,141,240,0.15); border-color: var(--accent); color: var(--accent); }
.status-pill.badge-accepted.active { background: rgba(232,155,62,0.15); border-color: var(--orange); color: var(--orange); }
.status-pill.badge-in_progress.active { background: rgba(156,111,222,0.15); border-color: #9c6fde; color: #9c6fde; }
.status-pill.badge-ready.active { background: rgba(76,175,80,0.15); border-color: var(--green); color: var(--green); }
.status-pill.badge-finished.active { background: rgba(85,85,102,0.15); border-color: var(--text-muted); color: var(--text-muted); }
.status-pill.badge-cancelled.active { background: rgba(224,85,85,0.15); border-color: var(--red); color: var(--red); }

/* ========== ADMIN ORDER CARDS (compact two-row) ========== */

.admin-order-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    overflow: hidden;
    transition: border-color 0.2s;
}

.admin-order-card:hover { border-color: var(--gold-dim); }

.aoc-row1 {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem 0.4rem;
}

.aoc-img { flex-shrink: 0; }
.aoc-img a { display: block; }
.aoc-img .thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; display: block; }

.aoc-main { flex: 1; min-width: 0; }
.aoc-title { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aoc-meta { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.1rem; }

.aoc-price {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.aoc-row2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 1rem 0.7rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.aoc-numbers {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.aoc-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ========== ORDER CARDS (student view) ========== */

.order-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.8rem;
    transition: border-color 0.2s;
}

.order-card:hover { border-color: var(--gold-dim); }

.order-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.order-card-info { flex: 1; min-width: 0; }
.order-card-title { font-weight: 700; }
.order-card-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

.order-card-right {
    text-align: right;
    flex-shrink: 0;
}

.order-card-price {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

/* ========== BOARD ========== */

.board-list {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

.board-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.board-item-info { flex: 1; }
.board-item-name { font-weight: 700; }
.board-item-title { color: var(--text-dim); font-size: 0.9rem; }
.board-item-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.board-item-price { color: var(--gold); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }

/* ========== FILTERS ========== */

.filters {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filters select,
.filters input {
    padding: 0.5rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
}


.filter-select {
    padding: 0.45rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    max-width: 320px;
}


.toggle-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--gold);
}

/* ========== SUCCESS ========== */

.success-msg {
    background: linear-gradient(135deg, rgba(76,175,80,0.15), rgba(76,175,80,0.05));
    border: 1px solid var(--green);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    color: var(--green);
    font-weight: 700;
    font-size: 1.1rem;
}

.success-msg .remaining {
    display: block;
    margin-top: 0.5rem;
    font-size: 2rem;
    color: var(--gold);
    font-family: 'Playfair Display', serif;
}

/* ========== VISIBILITY TOGGLE ========== */

.vis-toggle {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--text-muted);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.vis-toggle.on { background: var(--green); }

.vis-toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
}

.vis-toggle.on::after { transform: translateX(18px); }

/* ========== EMPTY STATE ========== */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: 1.1rem; }

/* ========== RESPONSIVE ========== */

@media (max-width: 600px) {
    .shop-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        padding: 1rem;
    }
    .shop-card-body { padding: 0.7rem; }
    .shop-card-title { font-size: 0.85rem; }
    .shop-card-price { font-size: 1.1rem; }
    .shop-header-top { flex-direction: column; text-align: center; }
    .admin-table { font-size: 0.8rem; }
    .admin-table th, .admin-table td { padding: 0.5rem; }
    .modal { padding: 1.5rem; }
    .balance-card { padding: 2rem 1.5rem; }
}

/* ========== PLASTIC COLORS ========== */

.color-dot {
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    vertical-align: -0.1em;
    margin-right: 0.25em;
}
.color-dot.other { background: conic-gradient(#d32f2f, #fbc02d, #388e3c, #1976d2, #7b1fa2, #d32f2f); }

.color-picker { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.color-picker button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    padding: 0;
    cursor: pointer;
}
.color-picker button.cp-text {
    width: auto;
    border-radius: 18px;
    padding: 0 0.8rem;
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
}
.color-picker button.selected { outline: 3px solid var(--gold); outline-offset: 2px; }
.color-chosen { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.4rem; min-height: 1.1em; }
