/* ============================================
   Custom CSS สำหรับเว็บไซต์เครื่องมือแพทย์
   ============================================ */

/* ============================================
   Global Styles
   ============================================ */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #6dd5ed 0%, #2193b0 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-color);
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    background: white !important;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.navbar-brand {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    font-size: 1.8rem;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* ============================================
   Hero Section
   ============================================ */
.hero-section {
    background: var(--gradient-1);
    color: white;
    padding: clamp(60px, 10vw, 100px) 0;
    margin-bottom: clamp(30px, 5vw, 50px);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') bottom center no-repeat;
    opacity: 0.3;
}

.hero-section h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.hero-section p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
    opacity: 0.95;
}

/* ============================================
   Cards (Category & Product)
   ============================================ */
.category-card,
.product-card {
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
}

.category-card:hover,
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.category-card .position-relative,
.product-card .position-relative {
    overflow: hidden;
    position: relative;
}

.category-card img,
.product-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.category-card:hover img,
.product-card:hover img {
    transform: scale(1.1);
}

.category-card .card-body,
.product-card .card-body {
    padding: clamp(15px, 3vw, 25px);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.category-card .card-title,
.product-card .card-title {
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.category-card .card-text,
.product-card .card-text {
    font-size: clamp(0.875rem, 1.5vw, 0.95rem);
    color: #6c757d;
    flex: 1;
    margin-bottom: 1rem;
}

.category-badge,
.product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    font-weight: 600;
    z-index: 10;
}

.product-badge {
    left: 15px;
    right: auto;
    background: var(--danger-color);
}

/* ============================================
   Product Price
   ============================================ */
.product-price {
    font-size: clamp(1.2rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

/* ============================================
   Product Detail Page
   ============================================ */
.product-detail-image {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    background: white;
    padding: 1rem;
}

.product-gallery {
    margin-top: 1rem;
}

.product-gallery img {
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    height: 80px;
    object-fit: cover;
}

.product-gallery img:hover,
.product-gallery img.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.product-info {
    background: white;
    padding: clamp(20px, 4vw, 40px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.product-info h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    line-height: 1.3;
}

.product-tabs {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 2rem;
}

.product-tabs .nav-link {
    color: #6c757d;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    transition: var(--transition);
}

.product-tabs .nav-link:hover {
    color: var(--primary-color);
}

.product-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: transparent;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: clamp(10px, 2vw, 14px) clamp(20px, 4vw, 32px);
    border-radius: 25px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.btn-primary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info {
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-info:hover {
    /* transform: translateY(-2px); */
    box-shadow: var(--shadow-md);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
    /* transform: translateY(-2px); */
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1.1rem;
}

/* ============================================
   Forms
   ============================================ */
.contact-form {
    background: white;
    padding: clamp(25px, 5vw, 50px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.form-control,
.form-select {
    border-radius: 10px;
    padding: 12px 20px;
    border: 2px solid #e9ecef;
    transition: var(--transition);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.1);
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

/* ============================================
   Search Bar
   ============================================ */
.search-bar {
    position: relative;
    max-width: 700px;
    margin: 0 auto 40px;
}

.search-bar input {
    border-radius: 50px;
    padding: 15px 60px 15px 25px;
    border: 2px solid #e9ecef;
    width: 100%;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.search-bar button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50px;
    padding: 10px 25px;
}

/* ============================================
   Breadcrumb
   ============================================ */
.breadcrumb {
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

/* ============================================
   Alerts & Badges
   ============================================ */
.alert {
    border-radius: var(--border-radius);
    border: none;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.badge {
    padding: 6px 14px;
    font-weight: 600;
    border-radius: 20px;
    font-size: clamp(0.75rem, 1.2vw, 0.85rem);
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    background: var(--gradient-1);
    color: white;
    padding: clamp(40px, 8vw, 80px) 0;
    margin-bottom: clamp(30px, 5vw, 50px);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') bottom center no-repeat;
    opacity: 0.3;
}

.page-header h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.page-header p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* ============================================
   Feature Icons
   ============================================ */
.feature-icon {
    width: clamp(50px, 10vw, 70px);
    height: clamp(50px, 10vw, 70px);
    background: var(--gradient-1);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-md);
}

/* ============================================
   Footer
   ============================================ */
footer {
    background: #2c3e50;
    color: white;
    margin-top: auto;
}

footer a {
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
}

footer a:hover {
    color: white;
    transform: translateX(5px);
}

footer h5 {
    font-size: clamp(1rem, 2vw, 1.2rem);
    margin-bottom: 1.5rem;
}

footer .list-unstyled li {
    margin-bottom: 0.75rem;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    gap: 0.5rem;
}

.page-link {
    border-radius: 8px;
    border: none;
    padding: 8px 16px;
    color: var(--primary-color);
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary-color);
    color: white;
    /* transform: translateY(-2px); */
}

.page-item.active .page-link {
    background: var(--primary-color);
    border: none;
}

/* ============================================
   Tables
   ============================================ */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    margin-bottom: 0;
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
}

.table thead {
    background: var(--light-color);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(13, 110, 253, 0.05);
}

/* ============================================
   Admin Styles
   ============================================ */
.admin-sidebar {
    background: #2c3e50;
    min-height: 100vh;
    color: white;
    width: 250px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 15px 20px;
    border-radius: 8px;
    margin: 5px 10px;
    transition: var(--transition);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    transform: translateX(5px);
}

.admin-sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.admin-header {
    background: white;
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ============================================
   Cards
   ============================================ */
.card {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: white;
    border-bottom: 2px solid #e9ecef;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

/* ============================================
   Image Preview
   ============================================ */
.image-preview {
    max-width: 100%;
    width: 200px;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

/* ============================================
   Utilities
   ============================================ */
.text-gradient {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: var(--gradient-1);
}

/* ============================================
   Responsive - Tablet
   ============================================ */
@media (max-width: 992px) {
    .hero-section {
        padding: 50px 0;
    }
    
    .product-info {
        margin-top: 2rem;
    }
    
    .admin-sidebar {
        width: 200px;
    }
    
    .admin-sidebar .nav-link {
        padding: 12px 15px;
    }
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 0;
        margin-bottom: 30px;
    }
    
    .category-card img,
    .product-card img {
        height: 180px;
    }
    
    .product-detail-image {
        max-height: 300px;
    }
    
    .product-gallery img {
        height: 60px;
    }
    
    .contact-form {
        padding: 25px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn {
        width: auto;
    }
    
    .d-grid .btn {
        margin-bottom: 0;
    }
    
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .page-header {
        padding: 30px 0;
    }
}

/* ============================================
   Responsive - Small Mobile
   ============================================ */
@media (max-width: 576px) {
    .category-card img,
    .product-card img {
        height: 150px;
    }
    
    .product-price {
        font-size: 1.3rem;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar,
    .admin-sidebar,
    .btn,
    footer {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card,
    .product-info {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* เพิ่มได้ถ้าต้องการรองรับ dark mode */
}

/* ============================================
   Animation Classes
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ============================================
   Accessibility
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   Back to Top Button
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50% !important;
    display: none;
    z-index: 999;
    padding: 0 !important;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.back-to-top i {
    font-size: 1.2rem;
    line-height: 1;
}

.back-to-top.show {
    display: flex;
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .back-to-top i {
        font-size: 1rem;
    }
}

/* ============================================
   End of Styles
   ============================================ */
