/* ============================================================================
   🛡️ style-admin.css: สไตล์เฉพาะระบบหลังบ้านแอดมิน (SmartWelf Admin Workspace)
   (ทำงานร่วมกับ style-shared.css โดยตัดโค้ดที่ซ้ำซ้อนออกทั้งหมด)
============================================================================ */

/* 📌 1. หน้าต่าง Login (Login Gate & Numpad) */
#loginGate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-dark);
    color: #FFFFFF;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px 0;
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    padding: 30px 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 92%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: auto;
}

.login-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    overflow: hidden;
}
.login-tab {
    flex: 1;
    padding: 12px 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    transition: 0.25s;
    white-space: nowrap;
}
.login-tab.active {
    background: var(--primary-main);
    color: #FFFFFF;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    transition: all 0.15s ease;
}
.pin-dot.filled,
.pin-dot.active {
    background-color: var(--success-main);
    border-color: var(--success-main);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 250px;
    margin: 0 auto;
    justify-items: center;
}
.num-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #FFFFFF;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.15s;
}
.num-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.9);
}

@media screen and (max-width: 380px) {
    .login-box { padding: 25px 15px; width: 95%; }
    .login-tab { font-size: 0.75rem; padding: 10px 2px; }
    #emailLoginSection .py-3 { padding-top: 0.85rem !important; padding-bottom: 0.85rem !important; font-size: 0.9rem; }
    #emailLoginSection .position-relative span {
        font-size: 0.7rem !important;
        white-space: nowrap;
        padding: 0 8px !important;
    }
    .numpad { gap: 10px; max-width: 220px; }
    .num-btn { width: 50px; height: 50px; font-size: 1.25rem; }
}

/* 📌 2. โครงสร้างหลักของแอดมิน (Admin App Structure) */
.app-header-admin {
    background: var(--primary-dark);
    background-image: radial-gradient(circle at top right, #1E293B 0%, transparent 60%);
    color: #FFFFFF;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 68px;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

#adminApp {
    padding-top: 72px;
    padding-bottom: calc(95px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    margin: 0 auto;
}

/* ไฮไลท์สีปุ่มเมนูด้านล่างฝั่งแอดมินเป็นสีน้ำเงินหลัก */
#adminApp .bottom-nav .nav-item.active {
    color: var(--primary-main);
}

/* 📌 3. การ์ดต่างๆ ในหน้าแอดมิน (Admin Cards & Glow Effects) */
.admin-card {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 1.2rem;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
    border: 1px solid var(--card-border);
    margin-bottom: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.admin-card-hover:active {
    transform: scale(0.98);
}

.wallet-card {
    margin-bottom: 1.5rem;
}
.wallet-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -30px;
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.4) 0%, rgba(16, 185, 129, 0.4) 100%);
    border-radius: 50%;
    filter: blur(30px);
    z-index: -1;
}
.wallet-card::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -20px;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(239, 68, 68, 0.2) 100%);
    border-radius: 50%;
    filter: blur(20px);
    z-index: -1;
}

/* จุดสัญญาณไฟสถานะ (Status Dots) */
.dot-red, .dot-green, .dot-yellow {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot-red { background-color: var(--danger-main); box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
.dot-green { background-color: var(--success-main); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.dot-yellow { background-color: var(--warning-main); box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }

/* 📌 4. ทะเบียนสมาชิก (Members List Slide-in Input UI) */
.member-row {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}
.member-checkbox-wrapper,
.member-avatar-wrapper {
    position: relative;
    z-index: 10;
}
.input-overlay {
    position: absolute;
    top: 0;
    right: -100%;
    bottom: 0;
    width: calc(100% - 90px);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 1) 15%);
    backdrop-filter: blur(2px);
    z-index: 5;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.member-row.show-input .input-overlay {
    right: 0;
}
.amount-badge-wrapper {
    cursor: pointer;
}

/* 📌 5. บัญชีการเงินและปฏิทินรายวัน (Ledger & Daily Calendar Strip) */
.tab-btn-ledger {
    width: 50%;
    padding: 0.7rem;
    text-align: center;
    border-radius: 1rem;
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--text-muted);
    transition: 0.25s;
    font-size: 0.85rem;
}
.tab-btn-ledger.active {
    background: #FFFFFF;
    color: var(--primary-main);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

#receiptHistoryContainer,
.horizontal-scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
#receiptHistoryContainer::-webkit-scrollbar,
.horizontal-scroll-container::-webkit-scrollbar {
    display: none;
}

.calendar-date-item {
    min-width: 55px;
    height: 65px;
    border-radius: var(--radius-md);
    background: #FFFFFF;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.calendar-date-item .day-name {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}
.calendar-date-item .date-num {
    font-size: 1.1rem;
    color: var(--primary-dark);
    font-weight: 700;
    line-height: 1;
}
.calendar-date-item:active {
    transform: scale(0.95);
}
.calendar-date-item.active-date {
    background: var(--primary-main);
    border-color: var(--primary-main);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.25);
    transform: translateY(-2px);
}
.calendar-date-item.active-date .day-name,
.calendar-date-item.active-date .date-num {
    color: #FFFFFF;
}

/* 📌 6. การจัดตำแหน่ง Header ของแอดมินบนจอใหญ่ (เสริมจาก style-shared.css) */
@media (min-width: 600px) and (max-width: 899px) {
    .app-header-admin {
        max-width: 680px;
        left: 50%;
        transform: translateX(-50%);
    }
    #adminApp {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (min-width: 900px) {
    .app-header-admin {
        max-width: 960px;
        left: 50%;
        transform: translateX(-50%);
        top: 25px;
        border-radius: 32px 32px 0 0;
    }
    #adminApp {
        padding: 90px 28px 50px 28px;
    }
}