/* ===================================================
   style.css - ธีมแดง-ทอง งานบุญผ้าป่าเพื่อการศึกษา
   โรงเรียนละหานทรายรัชดาภิเษก
   =================================================== */

/* ---- ตัวแปรหลัก ---- */
:root {
    --red-dark: #8b0000;
    --red: #c41e1e;
    --red-light: #e74c3c;
    --gold: #daa520;
    --gold-light: #f7e7a0;
    --gold-dark: #c8a84e;
    --brown: #5a3a1a;
    --brown-light: #8b5e34;
    --cream: #fff9e6;
}

/* ---- พื้นฐาน ---- */
body {
    font-family: 'Kanit', sans-serif;
    background: #faf7f0;
    color: #333;
}
a { color: var(--red); }
a:hover { color: var(--red-dark); }

/* ---- ส่วนหัวหน้าสาธารณะ ---- */
.hero-header {
    background: linear-gradient(135deg, #8b0000 0%, #c41e1e 50%, #8b0000 100%);
    color: #fff;
    padding: 2rem 1rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 20 L50 20 L38 30 L42 45 L30 35 L18 45 L22 30 L10 20 L25 20 Z' fill='%23ffd70010'/%3E%3C/svg%3E");
    opacity: 0.3;
    pointer-events: none;
}
.hero-header > * { position: relative; z-index: 1; }
.hero-header .school-name {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.95;
    margin-bottom: 0.3rem;
}
.hero-header .event-name {
    color: #ffd700;
    font-weight: 700;
    font-size: 1.4rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    margin-bottom: 1rem;
}
.hero-header .total-label {
    font-size: 0.95rem;
    opacity: 0.9;
}
.hero-header .total-amount {
    font-size: 2.8rem;
    color: #ffd700;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    line-height: 1.2;
}
.hero-header .total-suffix {
    font-size: 1.2rem;
    color: #ffd700;
    font-weight: 400;
}
.hero-header .donor-count {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.3rem;
}

/* ---- ปุ่มทอง ---- */
.btn-gold {
    background: linear-gradient(180deg, #f7e7a0 0%, #daa520 100%);
    color: var(--brown);
    border: 2px solid var(--gold-dark);
    font-weight: 700;
    font-size: 1.2rem;
    padding: 14px 32px;
    border-radius: 50px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(218,165,32,0.4);
    min-height: 48px;
}
.btn-gold:hover {
    background: linear-gradient(180deg, #ffe566 0%, #c8a84e 100%);
    color: var(--brown);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(218,165,32,0.5);
}
.btn-gold:active {
    transform: translateY(0);
}

/* ---- ปุ่มแดง ---- */
.btn-donate {
    background: linear-gradient(180deg, #e74c3c 0%, #c41e1e 100%);
    color: #fff;
    border: 2px solid #8b0000;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 12px;
    padding: 12px 24px;
    min-height: 48px;
}
.btn-donate:hover {
    background: linear-gradient(180deg, #ff6b5b 0%, #e74c3c 100%);
    color: #fff;
}

/* ---- หลอดความคืบหน้า ---- */
.progress-donate {
    height: 32px;
    border-radius: 16px;
    background: #f0e6d0;
    border: 2px solid var(--gold-dark);
    overflow: hidden;
}
.progress-donate .progress-bar {
    background: linear-gradient(90deg, #ffd700, #daa520);
    color: var(--brown);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 28px;
    border-radius: 14px;
    transition: width 0.6s ease;
}

/* ---- ตารางการ์ด ---- */
.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    padding: 0;
}
@media (min-width: 768px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
    .card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- การ์ดผู้บริจาค ---- */
.donate-card {
    border: 2px solid var(--gold);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}
.donate-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}
.donate-card .card-img-top {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    cursor: pointer;
}
.donate-card .card-body {
    padding: 0.8rem;
}
.donate-card .donor-name {
    font-weight: 600;
    color: var(--brown);
    font-size: 1rem;
    margin-bottom: 0.3rem;
}
.donate-card .donor-amount {
    color: var(--red);
    font-weight: 700;
    font-size: 1.1rem;
}
.donate-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.donate-card .card-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    padding: 6px 8px;
    min-height: 40px;
}

/* ---- ช่องค้นหา ---- */
.search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}
.search-box .form-control {
    padding-right: 48px;
    border: 2px solid var(--gold);
    border-radius: 50px;
    min-height: 48px;
    font-size: 1rem;
}
.search-box .btn-search {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    border-radius: 50%;
    width: 40px;
    background: var(--gold);
    color: #fff;
    border: none;
}

/* ---- ข้อมูลบัญชีธนาคาร ---- */
.bank-card {
    background: linear-gradient(135deg, var(--cream), #fff);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
}
.bank-card .bank-name {
    font-weight: 600;
    color: var(--brown);
    font-size: 1.1rem;
}
.bank-card .account-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--red);
    letter-spacing: 3px;
    margin: 0.5rem 0;
}
.bank-card .account-name {
    font-size: 0.95rem;
    color: #666;
}

/* ---- ฟอร์ม ---- */
.form-control, .form-select {
    min-height: 48px;
    font-size: 1.05rem;
    border-radius: 10px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(218,165,32,0.25);
}
.btn {
    min-height: 48px;
    font-size: 1rem;
    border-radius: 10px;
}
.form-label {
    font-weight: 600;
    color: var(--brown);
    margin-bottom: 0.4rem;
}

/* ---- ปุ่มเผยแพร่ ---- */
.publish-toggle {
    display: flex;
    gap: 0.5rem;
}
.publish-toggle .btn {
    flex: 1;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s;
}
.publish-toggle .btn-outline-success.active,
.publish-toggle .btn-outline-success:checked + label {
    background: #198754 !important;
    color: #fff !important;
    border-color: #198754 !important;
}
.publish-toggle .btn-outline-secondary.active,
.publish-toggle .btn-outline-secondary:checked + label {
    background: #6c757d !important;
    color: #fff !important;
    border-color: #6c757d !important;
}

/* ---- ดูตัวอย่างรูป ---- */
.img-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 2px solid #ddd;
    margin-top: 0.5rem;
    display: none;
}
.img-preview.show { display: block; }

/* ---- หน้าขอบคุณ ---- */
.thankyou-card {
    text-align: center;
    padding: 3rem 1.5rem;
    background: linear-gradient(135deg, var(--cream), #fff);
    border: 2px solid var(--gold);
    border-radius: 20px;
}
.thankyou-card .thankyou-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}
.thankyou-card .thankyou-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brown);
}
.thankyou-card .ref-number {
    font-size: 1.3rem;
    color: var(--red);
    font-weight: 600;
    margin: 1rem 0;
}

/* ---- คำแนะนำ iPhone ---- */
.iphone-tip {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
    text-align: center;
    margin-top: 0.3rem;
}

/* ---- Modal ภาพเต็ม ---- */
.modal-lightbox .modal-dialog {
    max-width: 95vw;
    margin: 1rem auto;
}
.modal-lightbox .modal-content {
    background: transparent;
    border: none;
}
.modal-lightbox .modal-body {
    padding: 0;
    text-align: center;
}
.modal-lightbox .modal-body img {
    width: 100%;
    border-radius: 8px;
}
.modal-lightbox .btn-close {
    position: absolute;
    top: -15px;
    right: -15px;
    z-index: 10;
    background-color: #fff;
    border-radius: 50%;
    padding: 8px;
    opacity: 1;
}
.modal-lightbox .modal-footer {
    justify-content: center;
    border: none;
    background: transparent;
}

/* ---- แอดมิน ---- */
.admin-nav {
    background: linear-gradient(135deg, var(--brown), var(--brown-light));
    padding: 0.8rem 1rem;
}
.admin-nav .navbar-brand {
    color: var(--gold-light) !important;
    font-weight: 600;
    font-size: 1rem;
}
.admin-nav .nav-link {
    color: rgba(255,255,255,0.8) !important;
    font-size: 0.9rem;
}
.admin-nav .nav-link:hover {
    color: #fff !important;
}

/* สถานะ badge */
.status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}
.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d1e7dd; color: #0f5132; }
.status-rejected { background: #f8d7da; color: #842029; }

/* badge สลิปซ้ำ */
.duplicate-badge {
    background: #dc3545;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* สลิปขนาดเล็ก */
.slip-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s;
}
.slip-thumb:hover {
    border-color: var(--gold);
}

/* ตัวอย่าง canvas */
.canvas-preview {
    width: 100%;
    max-width: 800px;
    border: 3px solid var(--gold);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* ---- แท็บแอดมิน ---- */
.admin-tabs .nav-link {
    color: var(--brown);
    font-weight: 500;
    border-radius: 10px 10px 0 0;
}
.admin-tabs .nav-link.active {
    color: var(--red);
    font-weight: 700;
    border-color: var(--gold) var(--gold) #fff;
}
.admin-tabs .badge {
    font-size: 0.7rem;
    margin-left: 4px;
}

/* ---- รายการในแอดมิน ---- */
.admin-item {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    background: #fff;
    transition: box-shadow 0.2s;
}
.admin-item:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* ---- ส่วนท้าย ---- */
.site-footer {
    background: var(--brown);
    color: rgba(255,255,255,0.7);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    margin-top: 3rem;
}
.site-footer a {
    color: var(--gold-light);
}

/* ---- หน้าล็อกอิน ---- */
.login-card {
    max-width: 400px;
    margin: 3rem auto;
    border: 2px solid var(--gold);
    border-radius: 20px;
    overflow: hidden;
}
.login-card .card-header {
    background: linear-gradient(135deg, var(--red-dark), var(--red));
    color: #fff;
    text-align: center;
    padding: 1.5rem;
    border: none;
}
.login-card .card-header h4 {
    margin: 0;
    font-weight: 700;
}

/* ---- ปุ่มแชร์ ---- */
.share-btn { display: none; }
.share-supported .share-btn { display: inline-flex !important; }

/* ---- Responsive ---- */
@media (max-width: 576px) {
    .hero-header .event-name { font-size: 1.2rem; }
    .hero-header .total-amount { font-size: 2.2rem; }
    .btn-gold { font-size: 1.1rem; padding: 12px 24px; }
    .bank-card .account-number { font-size: 1.5rem; }
}

/* ---- Utility ---- */
.text-gold { color: var(--gold) !important; }
.text-red { color: var(--red) !important; }
.text-brown { color: var(--brown) !important; }
.bg-cream { background: var(--cream) !important; }
.border-gold { border-color: var(--gold) !important; }

/* ---- Range slider admin ---- */
.form-range::-webkit-slider-thumb {
    background: var(--gold);
}
.form-range::-moz-range-thumb {
    background: var(--gold);
}

/* Loading spinner */
.spinner-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.spinner-overlay.show {
    display: flex;
}
