/* =========================================
   華懋倉庫系統 - 前端樣式表 (app.css)
   融合版: Google Forms 結構 + 原始圓潤風格 + Grid 常用項目
   ========================================= */

:root {
    --dt-navy: #1a365d;
    --dt-blue: #1a73e8;     /* Google Blue */
    --dt-accent: #1557b0;
    --dt-green: #188038;
    --dt-red: #d93025;
    --dt-bg: #f0f2f5;       /* 淺灰背景 */
    --dt-gray: #5f6368;
    --card-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15); /* 層次陰影 */
    --border-radius: 12px;  /* 統一圓角 */
}

body {
    padding-bottom: 60px;
    background-color: var(--dt-bg);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #202124;
    line-height: 1.6;
}

/* 頂部裝飾條 (Google Forms 風格) */
.top-accent {
    height: 12px;
    background-color: var(--dt-blue);
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    margin-bottom: -1px;
}

/* 核心容器 (卡片) */
.custom-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    background: #ffffff;
    transition: transform 0.2s;
    overflow: hidden; /* 讓 accent 不跑出去 */
}

/* 導航列 */
.navbar {
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.nav-pills-custom {
    gap: 8px;
    justify-content: center;
    padding: 6px;
    background: #f1f3f4;
    border-radius: 50px;
    display: inline-flex;
}

.nav-link-custom {
    border-radius: 30px !important;
    padding: 10px 24px;
    font-weight: 600;
    color: var(--dt-gray);
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-link-custom:hover {
    color: var(--dt-blue);
    background-color: rgba(26, 115, 232, 0.08);
}

.nav-link-custom.active {
    background-color: #fff !important;
    color: var(--dt-blue) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

/* 標題區塊 */
.section-title {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--dt-navy);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #dadce0;
    padding-bottom: 12px;
}
.section-title i {
    color: var(--dt-blue);
    margin-right: 12px;
    background: #e8f0fe;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* 表單元件 */
.field-group {
    margin-bottom: 24px;
}

.label-hint {
    font-size: 0.95rem;
    color: #202124;
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

.form-control, .form-select {
    border-radius: 4px;
    border: 1px solid #dadce0;
    padding: 10px 12px;
    font-size: 1rem;
    transition: border 0.2s, box-shadow 0.2s;
    background-color: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--dt-blue);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
    outline: none;
}
.form-control::placeholder {
    color: #9aa0a6;
}

/* VOC 輸入框 */
.voc-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #dadce0;
    border-radius: 4px;
    overflow: hidden;
}
.voc-prefix {
    padding: 0 12px;
    font-weight: 600;
    color: #5f6368;
    background: #f1f3f4;
    height: 44px;
    display: flex;
    align-items: center;
    border-right: 1px solid #dadce0;
}
.voc-field {
    border: none !important;
    background: transparent !important;
    flex: 1;
    height: 44px;
    box-shadow: none !important;
    padding-left: 12px;
}

/* 排版佈局 */
.row-group {
    display: flex;
    gap: 20px;
    width: 100%;
}
.row-left { flex: 1; }
.row-right { flex: 1; }

/* 常用項目區域 - 兩欄 Grid 佈局 */
#commonItemsArea {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 強制切成兩等分 */
    gap: 12px; /* 按鈕之間的間距 */
    width: 100%;
}

/* 常用項目按鈕 (卡片式) */
.common-btn {
    background: #fff;
    border: 1px solid #dadce0 !important;
    padding: 12px;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.2s;
    
    /* 確保內容佈局 */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 85px; /* 高度一致 */
    margin: 0 !important;
    width: 100%;
    position: relative;
}

.common-btn:hover {
    background-color: #e8f0fe !important;
    border-color: var(--dt-blue) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.common-btn b {
    display: block;
    font-size: 0.95rem;
    color: var(--dt-navy);
    margin-bottom: 4px;
    
    /* 文字過長省略 */
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis; 
}

/* 庫存資訊區塊 (位於按鈕底部) */
.common-btn-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #5f6368;
    border-top: 1px dashed #f1f3f4;
    padding-top: 8px;
    margin-top: 8px;
}

/* 低庫存警示 */
.low-stock { color: var(--dt-red) !important; font-weight: bold; }
.text-success { color: var(--dt-green) !important; font-weight: bold; }

.low-stock-btn {
    border-color: var(--dt-red) !important;
    background-color: #fff5f5 !important;
    animation: dt-pulse-alert 2s infinite;
}

@keyframes dt-pulse-alert {
    0% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(217, 48, 37, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0); }
}

/* 搜尋下拉選單 */
#searchList {
    background: #fff;
    border: 1px solid #dadce0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(32,33,36,0.28);
    position: absolute;
    width: 100%;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}
.search-opt {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
}
.search-opt:hover {
    background-color: #f1f3f4;
}

/* 購物車清單 */
#pendingListArea {
    max-height: 400px;
    overflow-y: auto;
}
.pending-item {
    padding: 12px;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pending-item:last-child {
    border-bottom: none;
}

/* 底部按鈕 */
#submitBtn {
    background-color: var(--dt-blue);
    border: none;
    padding: 12px;
    font-size: 1.1rem;
    border-radius: 4px;
    transition: background 0.2s;
}
#submitBtn:hover {
    background-color: var(--dt-accent);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* SweetAlert 字體優化 */
.swal2-popup {
    font-family: 'Segoe UI', Roboto, sans-serif;
    border-radius: 12px;
}

/* RWD 響應式 */
@media (max-width: 576px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    .custom-card {
        padding: 20px !important;
        border-radius: 8px;
    }
    .top-accent {
        border-radius: 8px 8px 0 0;
    }
    .row-group {
        flex-direction: column;
        gap: 0;
    }
    .row-left, .row-right {
        width: 100%;
        margin-bottom: 16px;
    }
    .nav-link-custom {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    /* 手機版常用項目微調 */
    #commonItemsArea {
        gap: 8px;
    }
    .common-btn {
        min-height: 75px;
        padding: 10px;
    }
}
