/* ==================== Admin Dashboard Styles ==================== */

.admin-wrapper {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    min-height: calc(100vh - 200px);
}

/* Header & Profile Badge */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: #1a1a1a;
}

.dashboard-subtitle {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.95rem;
}

.admin-profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.admin-profile-badge img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3b82f6;
}

.badge-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
}

.badge-email {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Overview Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.stat-icon span {
    font-size: 28px;
}

.bg-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.bg-green { background: linear-gradient(135deg, #10b981, #059669); }
.bg-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-info .stat-label {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.stat-info h3 {
    margin: 4px 0 0 0;
    font-size: 1.6rem;
    color: #111827;
}

/* Admin Panels & Tables */
.admin-panel {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 30px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2 span {
    color: #3b82f6;
}

.btn-add-product {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
}

.btn-add-product:hover {
    background-color: #1d4ed8;
}

.table-wrapper {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.dashboard-table th {
    background-color: #f9fafb;
    color: #374151;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid #e5e7eb;
}

.dashboard-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    color: #1f2937;
}

.dashboard-table tbody tr:hover {
    background-color: #f8fafc;
}

.table-avatar-thumb {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.table-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background-color: #f3f4f6;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
}

.status-pending { background-color: #fef3c7; color: #b45309; }
.status-approved { background-color: #d1fae5; color: #047857; }
.status-rejected { background-color: #fee2e2; color: #b91c1c; }

/* Table Action Buttons */
.action-btn-group {
    display: flex;
    gap: 8px;
}

.btn-approve {
    background-color: #10b981;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-approve:hover { background-color: #059669; }

.btn-edit {
    background-color: #f59e0b;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-edit:hover { background-color: #d97706; }

.btn-delete {
    background-color: #ef4444;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-delete:hover { background-color: #dc2626; }

/* Access Denied Card */
.access-denied-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    max-width: 500px;
    margin: 50px auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.icon-warning {
    font-size: 64px;
    color: #ef4444;
    margin-bottom: 10px;
}

.access-action {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
}

/* Modal Popup Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
}

.modal-box {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #111827;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
}

.modal-close:hover { color: #111827; }

#product-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #374151;
}

.required { color: #ef4444; }

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.95rem;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-save {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancel {
    background-color: #9ca3af;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

/* ==================== Custom Toast Notification (ส้ม / แดง / เขียว) ==================== */
.toast-container {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    background: #ffffff;
    color: #1f2937;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: all 0.3s ease;
}

/* 🟢 สีเขียว: สำเร็จ (Success) */
.toast-success {
    border-left: 6px solid #10b981;
    background: #f0fdf4;
    color: #166534;
}
.toast-success .toast-icon { color: #10b981; }

/* 🔴 สีแดง: ข้อผิดพลาด / ลบ (Error) */
.toast-error {
    border-left: 6px solid #ef4444;
    background: #fef2f2;
    color: #991b1b;
}
.toast-error .toast-icon { color: #ef4444; }

/* 🟠 สีส้ม: แจ้งเตือน / ข้อมูล (Warning / Info) */
.toast-warning, .toast-info {
    border-left: 6px solid #f59e0b;
    background: #fffbeeb;
    color: #92400e;
}
.toast-warning .toast-icon, .toast-info .toast-icon { color: #f59e0b; }

.toast-icon {
    font-size: 24px;
}

.toast-message {
    flex: 1;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-fade-out {
    opacity: 0;
    transform: translateX(100%);
}
/* ==================== Luxury Upload & Button Effects ==================== */
.luxury-modal-box {
    background: linear-gradient(145deg, #ffffff 0%, #faf9f6 100%) !important;
    border: 2px solid #d4af37 !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 60px rgba(212, 175, 55, 0.3), 0 0 25px rgba(0,0,0,0.15) !important;
    padding: 30px !important;
    animation: modalZoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalZoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* กล่องอัปโหลดรูปภาพดีไซน์ใหม่ */
.custom-image-upload-box {
    border: 2px dashed #d4af37;
    background: #fffdf7;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.custom-image-upload-box:hover {
    background: #fff7e6;
    border-color: #b8860b;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.15);
}

/* พื้นที่แสดงรูปตัวอย่างและเอฟเฟกต์ดินสอ */
.image-preview-wrapper {
    position: relative;
    width: 85px;
    height: 85px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #d4af37;
    background: #fff;
    flex-shrink: 0;
}

.image-preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* เอฟเฟกต์ไอคอนดินสอเมื่อเอาเมาส์เลื่อนผ่าน (Hover) */
.edit-overlay-icon {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-wrapper:hover .edit-overlay-icon {
    opacity: 1;
}

.image-preview-wrapper:hover img {
    transform: scale(1.1);
}

.upload-instruction-text {
    text-align: left;
}

.upload-instruction-text p {
    margin: 4px 0 2px 0;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.upload-instruction-text small {
    color: #888;
    font-size: 0.8rem;
}

/* เอฟเฟกต์ปุ่มกด (Click Ripple / Active Effect) */
.effect-btn {
    transition: all 0.2s ease !important;
}

.effect-btn:active {
    transform: scale(0.95) !important;
}
/* ==================== Responsive Modal สำหรับหน้าจอขนาดเล็ก (Mobile) ==================== */
@media screen and (max-width: 768px) {
    .luxury-modal-box {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        padding: 20px 15px !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-row-grid {
        grid-template-columns: 1fr !important; /* เปลี่ยนจาก 2 คอลัมน์เป็น 1 คอลัมน์บนมือถือ */
        gap: 0 !important;
    }

    .custom-image-upload-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .upload-instruction-text {
        text-align: center;
    }
}