/* ============================================================
   SITE EFFECTS – UI Polish, Micro-Interaction, Responsive
   ============================================================ */

/* ---------- CSS VARIABLES (Theme Bakery - ấm, nhẹ) ---------- */
:root {
    --primary: #c47b5b;
    --primary-soft: #e8c4b0;
    --primary-hover: #b36a4a;
    --text-main: #2d2d2d;
    --text-muted: #6b6b6b;
    --border-soft: #e8e4e0;
    --shadow-soft: 0 2px 12px rgba(45, 45, 45, 0.08);
    --shadow-hover: 0 12px 28px rgba(45, 45, 45, 0.12);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- MICRO-INTERACTION BASE ---------- */
.product-card,
.product-card .btn,
.product-detail-btn,
.admin-table .btn,
.admin-page .btn,
.admin-form .btn,
.admin-form .form-control,
.admin-form .form-select,
.navbar-nav .nav-link,
.admin-nav .navbar-nav .nav-link {
    transition: all 0.28s var(--ease-smooth);
}

/* Focus: outline mềm, không xanh gắt */
.admin-form .form-control:focus,
.admin-form .form-select:focus {
    outline: none;
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(196, 123, 91, 0.15);
}
.btn:focus,
.btn:focus-visible,
.navbar-nav .nav-link:focus,
.admin-nav .nav-link:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary-soft);
}

/* Active: scale nhẹ */
.product-card:active,
.btn:active:not(:disabled),
.admin-table .btn:active:not(:disabled) {
    transform: scale(0.98);
}
.product-card:active {
    transform: translateY(-2px) scale(0.99);
}

/* Disabled */
.btn:disabled,
.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- SECTION: KHÁCH HÀNG ---------- */

/* Hero section (landing feel) */
.hero-section {
    min-height: 55vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fdf8f5 0%, #f5ebe3 40%, #f0e6de 100%);
    border-radius: 16px;
    margin-bottom: 3rem;
    padding: 2rem 1.5rem;
}
.hero-content {
    text-align: center;
    max-width: 560px;
}
.hero-title {
    font-weight: 700;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    color: var(--text-main);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}
.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}
.hero-cta {
    background-color: var(--primary);
    border-color: var(--primary);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border-radius: 10px;
    transition: transform 0.25s var(--ease-smooth), background-color 0.25s var(--ease-smooth), box-shadow 0.25s var(--ease-smooth);
}
.hero-cta:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: scale(1.02);
}

/* Section title (visual hierarchy) */
.product-section {
    margin-bottom: 2.5rem;
}
.section-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--primary-soft);
    display: inline-block;
}

/* Page hero / intro (fallback for About, etc.) */
.page-hero {
    margin-bottom: 2rem;
}
.page-hero h2 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}
.page-hero p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Page title */
.page-title {
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

/* Product card */
.product-card {
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    transition: transform 0.32s var(--ease-smooth), box-shadow 0.32s var(--ease-smooth);
}
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

/* Stagger animation on load */
@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.product-card-item {
    animation: cardReveal 0.5s var(--ease-smooth) both;
}
.product-card-item:nth-child(1) { animation-delay: 0.05s; }
.product-card-item:nth-child(2) { animation-delay: 0.1s; }
.product-card-item:nth-child(3) { animation-delay: 0.15s; }
.product-card-item:nth-child(4) { animation-delay: 0.2s; }
.product-card-item:nth-child(5) { animation-delay: 0.25s; }
.product-card-item:nth-child(6) { animation-delay: 0.3s; }
.product-card-item:nth-child(n+7) { animation-delay: 0.35s; }

.product-card .card-img-wrap {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--border-soft);
}
.product-card .card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease-smooth);
}
.product-card:hover .card-img-top {
    transform: scale(1.06);
}
/* Overlay gradient rất nhẹ khi hover */
.card-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(45, 45, 45, 0.04) 100%);
    opacity: 0;
    transition: opacity 0.35s var(--ease-smooth);
    pointer-events: none;
}
.product-card:hover .card-img-overlay {
    opacity: 1;
}
/* Badge demo (New, Best seller) */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    letter-spacing: 0.02em;
}

.product-card .card-body {
    padding: 1.25rem;
}

.product-card .card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.product-price {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.product-card .btn {
    cursor: pointer;
    border-radius: 8px;
    background-color: var(--primary);
    border-color: var(--primary);
    transition: transform 0.2s var(--ease-smooth), background-color 0.25s var(--ease-smooth), border-color 0.25s var(--ease-smooth);
}
.product-card .btn:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

/* Empty state */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    background: linear-gradient(180deg, #faf9f8 0%, #fff 100%);
    border-radius: 12px;
    border: 1px dashed var(--border-soft);
}
.empty-state p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Product detail */
.product-detail-section {
    padding: 1rem 0;
}
.product-detail-section h2 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}
.product-detail-section h5 {
    font-weight: 600;
    margin-top: 1rem;
    color: var(--text-main);
}
.product-detail-section p {
    line-height: 1.6;
    color: var(--text-muted);
}

/* Product gallery (client) */
.product-gallery-wrap {
    overflow: hidden;
}
.product-gallery-main {
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 1;
    max-height: 400px;
    background: var(--border-soft);
    margin-bottom: 1rem;
}
.product-gallery-clickable {
    cursor: pointer;
}

/* Lightbox */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s var(--ease-smooth);
}
.lightbox-overlay.lightbox-open {
    display: flex;
    opacity: 1;
}
.lightbox-overlay.lightbox-open .lightbox-image {
    animation: lightboxScaleIn 0.3s var(--ease-smooth) forwards;
}
@keyframes lightboxScaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.lightbox-content {
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-image {
    max-width: 95vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s var(--ease-smooth);
    z-index: 10000;
}
.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.35);
}
.product-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease-smooth);
}
.product-gallery-main:hover img {
    transform: scale(1.03);
}
.product-gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
@media (max-width: 767px) {
    .product-gallery-thumbs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
}
.product-gallery-thumb {
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: var(--border-soft);
    transition: border-color 0.2s var(--ease-smooth), opacity 0.2s var(--ease-smooth);
}
.product-gallery-thumb:hover,
.product-gallery-thumb.active {
    border-color: var(--primary);
}
.product-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-img-wrap {
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 1;
    max-height: 400px;
    background: var(--border-soft);
}
.product-detail-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.4s var(--ease-smooth);
}
.product-detail-img-wrap:hover img {
    transform: scale(1.03);
}

.product-detail-btn {
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s var(--ease-smooth), background-color 0.25s var(--ease-smooth), border-color 0.25s var(--ease-smooth);
}
.product-detail-btn:hover {
    background-color: var(--text-muted);
    color: #fff !important;
    border-color: var(--text-muted);
}

/* About page */
.about-section {
    padding: 1rem 0;
}
.about-section h2 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}
.about-section p {
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Nav link (customer) */
.navbar-nav .nav-link {
    cursor: pointer;
    border-radius: 6px;
}

/* ---------- SECTION: ADMIN ---------- */

/* Layout & menu */
.admin-nav .navbar-nav .nav-link {
    cursor: pointer;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    transition: background-color 0.22s var(--ease-smooth);
}
.admin-nav .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
}
.admin-nav .navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.25);
}

/* Page header */
.admin-page-header {
    margin-bottom: 1.5rem;
}
.admin-page-header h2 {
    font-weight: 600;
    color: var(--text-main);
}
.admin-welcome p {
    max-width: 420px;
    line-height: 1.6;
}

/* Tables */
.admin-table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}
.admin-table thead th {
    font-weight: 600;
    background-color: #faf9f8;
    padding: 1rem 0.75rem;
    border-bottom: 2px solid var(--border-soft);
    color: var(--text-main);
}
.admin-table tbody td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
}
.admin-table tbody tr {
    transition: background-color 0.2s var(--ease-smooth);
}
.admin-table tbody tr:hover {
    background-color: #faf9f8;
}

/* Thumbnail in table */
.admin-thumbnail {
    aspect-ratio: 1;
    max-height: 48px;
    max-width: 48px;
    object-fit: cover;
    border-radius: 6px;
}
.admin-thumbnail-preview {
    max-height: 60px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
}

/* Admin gallery (upload, reorder, main) */
.gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.gallery-admin-item {
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    transition: box-shadow 0.2s var(--ease-smooth);
}
.gallery-admin-item:active {
    cursor: grabbing;
}
.gallery-admin-item.gallery-dragging {
    opacity: 0.6;
}
.gallery-admin-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.gallery-admin-actions {
    padding: 0.35rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}
.gallery-main-radio {
    margin: 0;
    cursor: pointer;
}
.gallery-drag-handle {
    color: var(--text-muted);
    cursor: grab;
}

/* Create product – image preview (multiple, removable) */
.create-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.create-preview-item {
    position: relative;
    width: 80px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    overflow: hidden;
}
.create-preview-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.create-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s var(--ease-smooth);
}
.create-preview-remove:hover {
    background: rgba(220, 53, 69, 0.9);
}

/* Forms */
.admin-form .form-control,
.admin-form .form-select {
    border-radius: 8px;
    border-color: var(--border-soft);
    transition: border-color 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth);
}
.admin-form .form-control:focus,
.admin-form .form-select:focus {
    border-color: var(--primary-soft);
}
.admin-form .form-label {
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--text-main);
}
.admin-form .form-text {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
}
.admin-form .text-danger {
    font-size: 0.875rem;
}

/* Buttons */
.admin-table .btn,
.admin-page .btn,
.admin-form .btn {
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s var(--ease-smooth), background-color 0.22s var(--ease-smooth), border-color 0.22s var(--ease-smooth);
}
.admin-table .btn:hover,
.admin-page .btn:hover,
.admin-form .btn:hover {
    transform: translateY(-1px);
}

/* Alert */
.admin-alert {
    border-radius: 10px;
}

/* ---------- RESPONSIVE ---------- */

/* Tablet (768px - 991px) */
@media (max-width: 991px) {
    .hero-section {
        min-height: 45vh;
        margin-bottom: 2.5rem;
    }
    .page-hero {
        margin-bottom: 1.5rem;
    }
    .product-card .card-body {
        padding: 1rem;
    }
    .admin-table thead th,
    .admin-table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    .hero-section {
        min-height: auto;
        padding: 2.5rem 1rem;
        margin-bottom: 2rem;
    }
    .hero-title {
        font-size: 1.5rem;
    }
    .page-hero {
        margin-bottom: 1.25rem;
    }
    .page-title {
        margin-bottom: 1rem;
    }
    .product-card .card-img-wrap {
        aspect-ratio: 16/10;
    }
    .product-card .card-body {
        padding: 1rem;
    }
    .product-card .btn {
        width: 100%;
    }
    .product-detail-img-wrap {
        aspect-ratio: 16/10;
        max-height: 260px;
    }
    .product-detail-btn {
        width: 100%;
    }
    .empty-state {
        padding: 2rem 1rem;
    }
    .admin-nav .navbar-collapse {
        margin-top: 0.5rem;
    }
    .admin-nav .navbar-nav .nav-link {
        padding: 0.6rem 1rem;
    }
    .admin-page .btn {
        width: 100%;
    }
    .admin-form .btn {
        width: 100%;
    }
    .admin-form .btn + .btn {
        margin-top: 0.5rem;
    }
    .admin-table {
        font-size: 0.875rem;
    }
    .admin-table thead th,
    .admin-table tbody td {
        padding: 0.6rem 0.4rem;
    }
    .admin-table .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}
