/* ============================================
   第三方攝影機廠商｜會員管理平台 - 共用樣式
   ============================================ */

:root {
    --primary-100: #d4eaf7;
    --primary-200: #b6ccd8;
    --primary-300: #3b3c3d;
    --accent-100: #71c4ef;
    --accent-200: #00668c;
    --text-100: #1d1c1c;
    --text-200: #313d44;
    --bg-100: #fffefb;
    --bg-200: #f5f4f1;
    --bg-300: #cccbc8;
    --success: #3a7d44;
    --warning: #c07d10;
    --danger: #a63d40;
    --radius: 6px;
    --shadow: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 12px rgba(0,0,0,0.08);
}

/* Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
    font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", -apple-system, sans-serif;
    line-height: 1.7;
    color: var(--text-100);
    background: var(--bg-200);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-200); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---- Typography ---- */
h1 { font-size: 1.6rem; font-weight: 700; color: var(--text-100); }
h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-100); }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-200); }
.text-secondary { color: var(--text-200); }
.text-small { font-size: 0.85rem; }

/* ---- Layout Helpers ---- */
.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 36px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

/* ---- Front-end Navbar ---- */
.navbar {
    background: var(--bg-100);
    border-bottom: 1px solid var(--bg-300);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-100);
}
.navbar-brand img { height: 28px; }
.navbar-nav {
    display: flex;
    list-style: none;
    gap: 4px;
}
.navbar-nav a {
    display: block;
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--text-200);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.navbar-nav a:hover {
    background: var(--bg-200);
    color: var(--text-100);
    text-decoration: none;
}
.navbar-nav a.active {
    background: var(--primary-100);
    color: var(--accent-200);
}
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---- Admin Sidebar ---- */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: var(--primary-300);
    color: #e8e8e8;
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}
.sidebar-brand .brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}
.sidebar-brand .brand-sub {
    font-size: 0.75rem;
    color: var(--bg-300);
    margin-top: 2px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #c8c8c8;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-decoration: none;
}
.sidebar-nav li a.active {
    background: rgba(113,196,239,0.12);
    color: var(--accent-100);
    border-left: 3px solid var(--accent-100);
}
.sidebar-nav .nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #888;
    padding: 16px 20px 6px;
}
.admin-main {
    padding: 32px 36px;
    background: var(--bg-200);
    min-height: 100vh;
}
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.admin-topbar h1 { font-size: 1.35rem; }

/* ---- Cards ---- */
.card {
    background: var(--bg-100);
    border: 1px solid var(--bg-300);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-body { padding: 20px 24px; }
.card-header {
    padding: 14px 24px;
    border-bottom: 1px solid var(--bg-300);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-200);
}

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.stat-card {
    background: var(--bg-100);
    border: 1px solid var(--bg-300);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-200);
    margin-bottom: 4px;
}
.stat-card .stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-100);
    line-height: 1.2;
}
.stat-card .stat-sub {
    font-size: 0.78rem;
    color: var(--bg-300);
    margin-top: 4px;
}
.stat-card.accent { border-top: 3px solid var(--accent-200); }

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
table.data-table th {
    background: var(--bg-200);
    color: var(--text-200);
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--bg-300);
    white-space: nowrap;
}
table.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--bg-300);
    color: var(--text-100);
}
table.data-table tbody tr:hover { background: var(--primary-100); }
table.data-table .mono {
    font-family: "SF Mono", "Fira Code", "Courier New", monospace;
    font-size: 0.82rem;
    color: var(--accent-200);
}

/* ---- Badges / Status ---- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: #dff0d8; color: var(--success); }
.badge-warning { background: #fef3d0; color: var(--warning); }
.badge-danger { background: #f8d7da; color: var(--danger); }
.badge-info { background: var(--primary-100); color: var(--accent-200); }
.badge-muted { background: var(--bg-200); color: var(--text-200); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: var(--accent-200);
    color: #fff;
    border-color: var(--accent-200);
}
.btn-primary:hover { background: #005574; }
.btn-secondary {
    background: var(--bg-100);
    color: var(--text-200);
    border-color: var(--bg-300);
}
.btn-secondary:hover { background: var(--bg-200); }
.btn-sm { padding: 4px 12px; font-size: 0.82rem; }
.btn-block { display: block; width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-200);
    margin-bottom: 6px;
}
.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--bg-300);
    border-radius: var(--radius);
    background: var(--bg-100);
    color: var(--text-100);
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent-100);
    box-shadow: 0 0 0 3px rgba(113,196,239,0.15);
}
.form-control::placeholder { color: var(--bg-300); }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-hint {
    font-size: 0.78rem;
    color: var(--bg-300);
    margin-top: 4px;
}

/* ---- Filter / Search Bar ---- */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 0;
    flex-wrap: wrap;
}
.filter-bar .form-control {
    width: auto;
    min-width: 180px;
}
.search-input {
    position: relative;
}
.search-input input {
    padding-left: 36px;
}
.search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bg-300);
}

/* ---- Detail / Expand Row ---- */
.detail-row { display: none; }
.detail-row.show { display: table-row; }
.detail-row td {
    background: var(--bg-200);
    padding: 16px 24px;
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 24px;
    font-size: 0.85rem;
}
.detail-grid dt { color: var(--text-200); font-weight: 600; }
.detail-grid dd { color: var(--text-100); word-break: break-all; }

/* ---- Timeline ---- */
.timeline { list-style: none; position: relative; }
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--bg-300);
}
.timeline li {
    position: relative;
    padding-left: 28px;
    padding-bottom: 16px;
}
.timeline li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-100);
    border: 2px solid var(--bg-100);
}
.timeline .time-label {
    font-size: 0.78rem;
    color: var(--bg-300);
}
.timeline .time-text {
    font-size: 0.88rem;
    color: var(--text-100);
}

/* ---- Modal (simple) ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 500;
    justify-content: center;
    align-items: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-100);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--bg-300);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-200);
    padding: 4px;
}
.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--bg-300);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ---- Page Header ---- */
.page-header {
    padding: 32px 0 24px;
}
.page-header h1 { margin-bottom: 4px; }
.page-header p { color: var(--text-200); font-size: 0.9rem; }

/* ---- Wallet Info ---- */
.wallet-card {
    background: linear-gradient(135deg, var(--primary-300) 0%, #2a4a5f 100%);
    color: #fff;
    border-radius: 8px;
    padding: 24px 28px;
}
.wallet-card .wallet-label {
    font-size: 0.78rem;
    color: var(--primary-200);
    margin-bottom: 4px;
}
.wallet-card .wallet-address {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.92rem;
    letter-spacing: 0.5px;
    word-break: break-all;
}
.wallet-card .wallet-meta {
    margin-top: 12px;
    display: flex;
    gap: 24px;
    font-size: 0.82rem;
    color: var(--primary-200);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-200);
}
.empty-state p { font-size: 0.9rem; margin-top: 8px; }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    justify-content: flex-end;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-200);
    border: 1px solid var(--bg-300);
}
.pagination a:hover { background: var(--bg-200); text-decoration: none; }
.pagination .active {
    background: var(--accent-200);
    color: #fff;
    border-color: var(--accent-200);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .admin-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .detail-grid { grid-template-columns: 1fr; }
}
