/* public/assets/css/components.css (V28.48.0 - Duplicate Removed) */

/* 1. 容器與基礎卡片 */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background-color: var(--bg-card);
    /* 變數 */
    border: 1px solid var(--border-color);
    /* 變數 */
    border-radius: var(--radius-main);
    padding: 2vw;
    color: var(--text-main);
    /* 變數 */
}

.section-card,
.card,
.form-card,
.booking-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-main);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-soft);
    color: var(--text-main);
    position: relative;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.section-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.2rem;
}

/* 2. 表單元件 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-input);
    /* 變數 */
    border: 1px solid var(--border-input);
    /* 變數 */
    color: var(--text-main);
    /* 變數 */
    border-radius: var(--radius-main);
    font-size: 1rem;
    outline: none;
    transition: border 0.2s, background 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--c-brand-blue);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* 3. 表格 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-main);
    background-color: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    background-color: var(--bg-hover);
    /* 變數 */
    color: var(--text-main);
    font-weight: 700;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    font-size: 0.95rem;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--bg-hover);
}

/* 4. Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--bg-modal-overlay);
    backdrop-filter: blur(3px);

    /* 🚨 Modern Pivot: Use Flex for centering instead of Block/Margin */
    /* This allows "Center if small" and "Scroll if tall" behavior */
    display: none;
    /* Default hidden */
    flex-direction: column;
    align-items: center;
    /* Center Horizontal */
    justify-content: center;
    /* Center Vertical (default) */
    padding: 20px;
    /* Safety padding around content */
}

/* Force Flex when JS sets display: block */
.modal[style*="display: block"],
.modal[style*="display:block"] {
    display: flex !important;
}

/* 📱 APP Mode Safe Area Override */
body.is-app-mode .modal {
    padding-top: 60px !important;
    /* User Requirement: 60px from top */
    justify-content: flex-start;
    /* Align top to respect padding */
}

/* If content is short, margin: auto will center it in the remaining space (Flexbox Magic) */
/* If content is tall, margin: auto top will be 0 (effective), obeying padding-top: 60px */

.modal-content {
    background-color: var(--bg-card);
    /* 變數 */
    margin: auto;
    /* 🚨 KEY: Auto margin centers in flex container */
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    /* Prevent total overflow of viewport */
    overflow-y: auto;
    /* Internal scroll */
    box-shadow: var(--shadow-card);
    color: var(--text-main);
    /* 變數 */
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close,
.close-btn {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
}

.close:hover {
    color: var(--text-main);
}

/* 5. 標籤與文字 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
}

.status-verified {
    color: #1b5e20;
    background-color: var(--bg-status-success);
}

.status-pending {
    color: #e65100;
    background-color: var(--bg-status-warning);
}

.status-rejected {
    color: #b71c1c;
    background-color: var(--bg-status-danger);
}

.status-conflict {
    color: #b71c1c;
    background-color: var(--bg-status-danger);
}

.badge-role {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Dark Mode 特定調整 (如果變數無法完全覆蓋) */
[data-theme="dark"] .status-verified {
    color: #81c784;
    background-color: rgba(27, 94, 32, 0.4);
}

[data-theme="dark"] .status-pending {
    color: #ffcc80;
    background-color: rgba(230, 81, 0, 0.4);
}

[data-theme="dark"] .status-rejected {
    color: #ef9a9a;
    background-color: rgba(183, 28, 28, 0.4);
}

[data-theme="dark"] .status-conflict {
    color: #ef9a9a;
    background-color: rgba(183, 28, 28, 0.4);
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

.text-danger {
    color: var(--c-brand-red);
}

.text-success {
    color: var(--c-brand-green);
}

/* 6. 通知中心樣式 */
.notification-area {
    position: relative;
}

.bell-btn {
    background: none;
    border: none;
    color: #ffffff !important;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bell-btn:hover {
    opacity: 0.8;
}

.bell-btn i {
    font-size: 1.4rem;
}

.badge-count {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--c-brand-red);
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 1;
    border: 1px solid white;
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 120%;
    right: -10px;
    width: 320px;
    background-color: var(--bg-card);
    /* 變數 */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-main);
    box-shadow: var(--shadow-card);
    z-index: 1100;
    overflow: hidden;
}

.notification-dropdown.show {
    display: block;
    animation: fadeIn 0.2s;
}

.notify-header {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    background: var(--bg-hover);
}

.notify-list {
    max-height: 300px;
    overflow-y: auto;
}

.notify-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    display: block;
    text-decoration: none;
    transition: background 0.2s;
}

.notify-item:hover {
    background-color: var(--bg-hover);
}

.notify-item.unread {
    background-color: var(--bg-status-info);
    border-left: 3px solid var(--c-brand-blue);
}

.notify-item h4 {
    margin: 0 0 5px;
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: bold;
}

.notify-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.notify-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
    text-align: right;
}

.notify-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-hover);
}

.notify-footer a {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--c-brand-blue);
}


/* =========================================
   Slot Item Layout (簡約佈局擴充)
   ========================================= */

.slot-item {
    /* 基礎卡片樣式 (沿用變數) */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-main);
    box-shadow: var(--shadow-soft);
    margin-bottom: 15px;
    overflow: hidden;

    /* 預設佈局 (手機版垂直堆疊) */
    display: flex;
    flex-direction: column;
}

/* 左側邊框狀態色 (沿用現有顏色變數) */
.slot-item.verified {
    border-left: 5px solid var(--c-brand-green);
}

.slot-item.pending {
    border-left: 5px solid var(--c-brand-orange);
}

.slot-item.rejected {
    border-left: 5px solid var(--c-brand-red);
}

.slot-item.conflict {
    border-left: 5px solid #ab47bc;
}

/* 內部區塊通用設定 */
.slot-cell {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    /* 手機版分隔線 */
}

.slot-cell:last-child {
    border-bottom: none;
}

/* 1. 頭部 (號碼) */
.slot-head {
    display: flex;
    justify-content: space-between;
    /* 手機版左右撐開 */
    align-items: center;
    background: var(--bg-hover);
    /* 淺灰背景區隔 */
}

.slot-num-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

/* 2. 內容 (資訊) */
.slot-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 3. 底部 (操作) */
.slot-foot {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

/* ===== PC 版佈局覆寫 (>= 769px) ===== */
@media (min-width: 769px) {
    .slot-item {
        flex-direction: row;
        /* 轉為橫向 */
        align-items: center;
        /* 垂直置中 */
    }

    .slot-cell {
        border-bottom: none;
        /* 移除水平分隔線 */
        border-right: 1px solid var(--border-color);
        /* 改為垂直分隔線 */
    }

    .slot-cell:last-child {
        border-right: none;
    }

    /* 頭部：固定寬度、垂直置中 */
    .slot-head {
        width: 150px;
        min-width: 150px;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        align-self: stretch;
        /* 撐滿高度 */
    }

    /* 內容：橫向排列 */
    .slot-body {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    /* 操作區：固定最小寬度 
    .slot-foot {
        min-width: 280px;
    }*/
}

/* =========================================
   Lending Config UI (還原 UI 樣式)
   ========================================= */

/* 1. 外框與手風琴 */
.config-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-row {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    overflow: hidden;
    transition: all 0.2s;
}

.config-row.active {
    border-color: var(--c-brand-blue);
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.1);
}

.config-header {
    background: var(--bg-hover);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}

.config-body {
    display: none;
    /* 預設隱藏 */
    padding: 15px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.config-body.active {
    display: block;
    /* JS 控制顯示 */
    animation: fadeIn 0.2s ease-in-out;
}

/* 2. 時間選擇器行 */
.time-slots-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.time-slot-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* 3. 下拉選單群組 */
.time-group {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 5px;
}

.t-sel {
    border: none;
    background: transparent;
    font-family: monospace;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-main);
    padding: 5px 2px;
    cursor: pointer;
    appearance: none;
    /* 移除瀏覽器預設樣式 */
    -webkit-appearance: none;
    text-align: center;
}

.t-sel:focus {
    outline: none;
    background: var(--bg-hover);
}

/* 4. 按鈕與開關 */
.custom-time-btn-wrap {
    margin-top: 10px;
    text-align: center;
}

.btn-add-time {
    border: 1px dashed var(--c-brand-blue);
    color: var(--c-brand-blue);
    background: transparent;
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.btn-add-time:hover {
    background: var(--bg-status-info);
}

.remove-time {
    color: var(--c-brand-red);
    cursor: pointer;
    font-size: 1.2em;
    margin-left: auto;
    transition: transform 0.2s;
}

.remove-time:hover {
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🚨 注意：這裡移除了 "16. Parking Control" 的部分，因為已經正確地歸類在 modules.css 中 */

/* -----------------------------------------------------------
   7. Onboarding & Registration (Large Tabs)
   ----------------------------------------------------------- */
.onboarding-tabs-large {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.tab-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    user-select: none;
    outline: none;
}

.tab-card i {
    font-size: 2rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.tab-card .tab-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-main);
}

.tab-card .tab-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.tab-card:hover {
    border-color: var(--c-brand-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.tab-card.active {
    border-color: var(--c-brand-blue);
    background-color: var(--bg-hover);
    box-shadow: 0 0 0 1px var(--c-brand-blue);
}

.tab-card.active i {
    color: var(--c-brand-blue);
}

.tab-card.active .tab-title {
    color: var(--c-brand-blue);
}

.tab-card.active::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--c-brand-blue);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

@media (max-width: 480px) {
    .onboarding-tabs-large {
        grid-template-columns: 1fr;
    }
}

/* 6. 頭像與小圖示 */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--bg-hover);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: 1px solid var(--border-color);
}

/* =========================================
   8. System Utility Classes (Standardization)
   ========================================= */

/* Flexbox & Layout */
.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-center {
    justify-content: center !important;
}

.flex-column {
    flex-direction: column !important;
}

/* Spacing ( Bootstrap-like ) */
.gap-1 {
    gap: 0.25rem !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.gap-3 {
    gap: 1rem !important;
}

.m-0 {
    margin: 0 !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.p-3 {
    padding: 1rem !important;
}

.py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

.px-5 {
    padding-left: 3rem !important;
    padding-right: 3rem !important;
}

.w-100 {
    width: 100% !important;
}

.h-100 {
    height: 100% !important;
}

/* Typography & Visuals */
.text-center {
    text-align: center !important;
}

.text-end {
    text-align: right !important;
}

.text-start {
    text-align: left !important;
}

.font-bold {
    font-weight: 700 !important;
}

.rounded {
    border-radius: var(--radius-main) !important;
}

.rounded-pill {
    border-radius: 50rem !important;
}

/* Color Tokens (Unification) */
.text-primary {
    color: var(--c-brand-blue) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-orange {
    color: #f57c00 !important;
}

.text-dark {
    color: var(--text-main) !important;
}

.bg-light {
    background-color: var(--bg-hover) !important;
}

.bg-white {
    background-color: var(--bg-card) !important;
}

.bg-orange-light {
    background-color: rgba(255, 152, 0, 0.1);
}

.bg-blue-light {
    background-color: rgba(33, 150, 243, 0.1);
}

/* Alert Standard */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}