/* =========================================
   華懋倉庫系統 - 後台樣式表 (admin.css)
   來源: admin.txt
   ========================================= */

:root {
    --primary-blue: #1e3a8a;
    --accent-blue: #3b82f6;
    --success-green: #10b981;
    --danger-red: #ef4444;
    --warning-amber: #f59e0b;
    --bg-light: #f8fafc;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--bg-light);
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    color: #1e293b;
    padding: 20px;
}

/* 工具列容器 */
.admin-toolbar-container {
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: var(--card-shadow);
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 12px; }
.toolbar-center { flex-grow: 1; display: flex; justify-content: center; min-width: 250px; }

/* 搜尋框 */
#adminSearchInput {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
    font-weight: 600;
}

#adminSearchInput:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 表格樣式 */
.custom-card {
    border: none !important;
    box-shadow: var(--card-shadow) !important;
    border-radius: 16px !important;
    margin-bottom: 25px;
    background: white;
    overflow: hidden;
}

.sticky-top-th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f1f5f9 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#inventoryTable, #historyTable {
    table-layout: auto !important;
    width: 100%;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 12px 10px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    text-align: center;
    font-size: 0.9rem;
}

.table tbody td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
    font-size: 0.95rem;
}

.table-hover tbody tr:hover { background-color: #f8fafc; }

/* 表格欄位特化 */
#inventoryTable td:first-child { width: 120px; font-weight: bold; color: var(--primary-blue); }
#inventoryTable td:nth-child(2) {
    white-space: normal !important;
    min-width: 220px;
    text-align: left;
    font-size: 1.0rem !important;
    font-weight: 700 !important;
    color: #0f172a;
}
#inventoryTable td:nth-child(10) { /* 庫存欄 */
    font-size: 1.1rem !important;
    color: var(--primary-blue) !important;
    font-weight: 800 !important;
    background-color: #eff6ff;
}

/* 編輯模式 */
.edit-switch-wrapper {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    user-select: none;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.edit-switch-wrapper:hover { border-color: var(--danger-red); }

.edit-input-field {
    width: 100%;
    max-width: 90px;
    text-align: center;
    font-weight: bold;
    color: var(--accent-blue);
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 4px;
    background-color: #fff;
    font-size: 0.9rem;
}

.edit-input-field:focus {
    background-color: #eff6ff;
    border-color: var(--accent-blue);
    outline: none;
}

/* 藥丸開關 (Notification Switches) */
.pill-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.pill-switch input { opacity: 0; width: 0; height: 0; }

.pill-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 30px;
}

.pill-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

#mailSwitch:checked + .pill-slider { background-color: #007bff; }
#lineSwitch:checked + .pill-slider { background-color: #28a745; }
input:checked + .pill-slider:before { transform: translateX(30px); }

/* 驗證覆蓋層 */
#adminAuthOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    z-index: 9999;
}

/* 狀態標籤 */
#refreshStatus {
    font-size: 0.85rem;
    color: var(--success-green);
    font-weight: bold;
    display: none;
    margin-right: 12px;
    background: #ecfdf5;
    padding: 4px 12px;
    border-radius: 20px;
}

.shortcut-tag {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 6px 14px;
    margin: 5px;
    display: inline-flex;
    align-items: center;
    font-size: 0.95rem;
    color: #334155;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.shortcut-tag:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

/* 列印樣式 */
@media print {
    .btn, .export-btn-group, .pagination-ctrl, .admin-toolbar-container { display: none !important; }
    #inventoryTable, #historyTable { width: 100%; font-size: 10pt; }
    body { padding: 0; background: white; }
    .card { box-shadow: none; }
}

/* RWD */
@media (max-width: 768px) {
    .table thead th { padding: 8px; font-size: 0.8rem; }
    .table tbody td { padding: 8px; font-size: 0.85rem; }
    #inventoryTable td:nth-child(2) { font-size: 0.9rem !important; min-width: 150px; }
    .admin-toolbar-container { padding: 12px; gap: 10px; flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { justify-content: space-between; }
    #adminSearchInput { width: 100%; }
}
