/* ============================================
   CUSTOM BLUE MODERN THEME - Nguyễn Hoàng Hào
   ============================================ */

/* --- CSS Variables --- */
:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --primary-gradient: linear-gradient(135deg, #0D47A1 0%, #1976D2 50%, #42A5F5 100%);
    --accent: #00B0FF;
    --surface: #F5F8FC;
    --surface-card: #FFFFFF;
    --text-primary: #1A2332;
    --text-secondary: #5A6A7E;
    --text-light: #8E99A8;
    --border: #E2E8F0;
    --shadow-sm: 0 1px 3px rgba(13, 71, 161, 0.08);
    --shadow-md: 0 4px 14px rgba(13, 71, 161, 0.12);
    --shadow-lg: 0 10px 30px rgba(13, 71, 161, 0.15);
    --shadow-xl: 0 20px 50px rgba(13, 71, 161, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Styles --- */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--surface);
    color: var(--text-primary);
    margin-bottom: 80px;
    line-height: 1.6;
}

/* --- Navbar --- */
#mainNavbar {
    background: var(--primary-gradient) !important;
    border: none;
    padding: 0.6rem 0;
    backdrop-filter: blur(20px);
    transition: var(--transition);
}

#mainNavbar .navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.3px;
    color: #fff !important;
    transition: var(--transition);
}

#mainNavbar .navbar-brand:hover {
    transform: scale(1.03);
}

.nav-hover-effect {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    position: relative;
}

.nav-hover-effect:hover,
.nav-hover-effect.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* --- Page Headers --- */
.page-header {
    background: var(--primary-gradient);
    color: #fff;
    padding: 2rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.page-header h2 {
    font-weight: 700;
    font-size: 1.75rem;
    margin: 0;
    position: relative;
    z-index: 1;
}

.page-header p {
    opacity: 0.9;
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

/* --- Cards --- */
.card-custom {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-custom .card-header {
    background: linear-gradient(135deg, #F0F7FF 0%, #E8F0FE 100%);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.card-custom .card-body {
    padding: 1.5rem;
}

/* --- Tables --- */
.table-custom {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-custom thead th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.9rem 1rem;
    border: none;
    white-space: nowrap;
}

.table-custom tbody tr {
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.table-custom tbody tr:hover {
    background: linear-gradient(135deg, #F0F7FF 0%, #E8F4FD 100%);
    transform: scale(1.002);
}

.table-custom tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* --- Buttons --- */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.2rem;
    font-size: 0.875rem;
    transition: var(--transition);
    letter-spacing: 0.2px;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0D47A1 0%, #1565C0 100%);
    box-shadow: 0 4px 14px rgba(21, 101, 192, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #2E7D32 0%, #43A047 100%);
    color: #fff;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%);
    box-shadow: 0 4px 14px rgba(46, 125, 50, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #E65100 0%, #FB8C00 100%);
    color: #fff;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #BF360C 0%, #E65100 100%);
    box-shadow: 0 4px 14px rgba(230, 81, 0, 0.4);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #C62828 0%, #EF5350 100%);
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #B71C1C 0%, #C62828 100%);
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #0277BD 0%, #29B6F6 100%);
    color: #fff;
    border: none;
}

.btn-info:hover {
    background: linear-gradient(135deg, #01579B 0%, #0277BD 100%);
    box-shadow: 0 4px 14px rgba(2, 119, 189, 0.4);
    color: #fff;
}

.btn-outline-secondary {
    border: 2px solid var(--border);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--surface);
    border-color: var(--primary-light);
    color: var(--primary);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* --- Forms --- */
.form-control,
.form-select {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--surface-card);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.15);
    background: #fff;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.2px;
}

.form-text {
    color: var(--text-light);
    font-size: 0.8rem;
}

textarea.form-control {
    min-height: 100px;
}

/* --- Validation --- */
.text-danger {
    font-size: 0.8rem;
    font-weight: 500;
}

.field-validation-error {
    color: #C62828;
    font-size: 0.8rem;
    font-weight: 500;
    display: block;
    margin-top: 0.25rem;
}

.input-validation-error {
    border-color: #EF5350 !important;
    box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.15) !important;
}

/* --- Badge --- */
.badge-category {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

/* --- Detail List --- */
.detail-list dt {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.detail-list dd {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.detail-list dd:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* --- Delete Confirm --- */
.delete-confirm-card {
    border: 2px solid #FFCDD2;
    background: linear-gradient(135deg, #FFF5F5 0%, #FFEBEE 100%);
}

.delete-confirm-card .card-header {
    background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%) !important;
    color: #C62828;
    border-bottom-color: #FFCDD2;
}

/* --- Footer --- */
.footer-custom {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 1.2rem 0;
    background: var(--primary-gradient);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 400;
}

/* --- Animations --- */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Action Buttons Group --- */
.action-buttons .btn {
    margin-right: 0.25rem;
}

.action-buttons .btn:last-child {
    margin-right: 0;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-light);
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* --- Price Tag --- */
.price-tag {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* --- Focus Styles --- */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(21, 101, 192, 0.25);
}

/* --- Responsive --- */
@media (max-width: 576px) {
    .page-header {
        padding: 1.5rem 1.25rem;
    }

    .page-header h2 {
        font-size: 1.35rem;
    }

    .table-custom thead th,
    .table-custom tbody td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ===== PRODUCT CARDS ===== */
.product-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
}

.product-card-img-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
}

.product-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-card-img {
    transform: scale(1.08);
}

.product-card-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--primary-light);
    gap: 0.5rem;
}

.image-count-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.category-float-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(21, 101, 192, 0.85);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.product-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.product-card-desc {
    line-height: 1.4;
    min-height: 2.8em;
}

.product-card-price {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
}

/* Sub-images strip on product card */
.card-sub-images {
    display: flex;
    gap: 3px;
    padding: 6px 8px;
    background: #f0f4f8;
    border-top: 1px solid var(--border);
    overflow: hidden;
}

.card-sub-thumb {
    flex: 1;
    min-width: 0;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #fff;
    transition: var(--transition);
}

.card-sub-thumb:hover {
    transform: scale(1.05);
    border-color: var(--primary-light);
}

.card-sub-more {
    flex: 1;
    min-width: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ===== IMAGE GALLERY (Display page) ===== */
.main-image-display img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: #f8f9fa;
}

.no-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
    color: var(--primary-light);
    gap: 0.5rem;
}

.gallery-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.7;
}

.gallery-thumb:hover {
    opacity: 1;
    border-color: var(--primary-light);
    transform: scale(1.05);
}

.gallery-thumb.active-thumb {
    border-color: var(--primary);
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.3);
}

.product-detail-price {
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--primary);
}

/* ===== IMAGE UPLOAD PREVIEW ===== */
.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.image-preview-thumb {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.image-preview-thumb:hover {
    border-color: var(--primary-light);
    transform: scale(1.05);
}

.current-image-box {
    background: linear-gradient(135deg, #F0F7FF 0%, #E8F0FE 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.current-image-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}