/* ============================================
   Custom CSS สำหรับระบบค้นหารถแม็คโคร
   ============================================ */

/* CSS Variables / Theme Colors */
:root {
    --primary: #ff6b35;
    --primary-dark: #e65a2e;
    --secondary: #ff8c42;
    --accent: #ffa600;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    --transition-fast: 150ms;
    --transition-normal: 300ms;
    --transition-slow: 500ms;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Custom Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Animation Utility Classes */
.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease-out;
}

.animate-slide-up {
    animation: slideInUp var(--transition-normal) ease-out;
}

.animate-slide-down {
    animation: slideInDown var(--transition-normal) ease-out;
}

.animate-slide-left {
    animation: slideInLeft var(--transition-normal) ease-out;
}

.animate-slide-right {
    animation: slideInRight var(--transition-normal) ease-out;
}

.animate-scale-in {
    animation: scaleIn var(--transition-normal) ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Gradient Backgrounds */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.gradient-orange {
    background: linear-gradient(135deg, #ff6b35 0%, #ffa600 100%);
}

.gradient-sunset {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 50%, #ffa600 100%);
}

.gradient-dark {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
}

/* Text Gradients */
.text-gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card Hover Effects */
.card-hover {
    transition: all var(--transition-normal) ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--gray-300);
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Custom Form Elements */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

/* Alert Boxes */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    border-color: var(--error);
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--info);
    color: #1e40af;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-300) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive Image */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Aspect Ratio Containers */
.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-4-3 {
    aspect-ratio: 4 / 3;
}

/* Text Utilities */
.text-balance {
    text-wrap: balance;
}

.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--gray-200);
    margin: 2rem 0;
}

.divider-vertical {
    width: 1px;
    background: var(--gray-200);
    height: 100%;
}

/* No Select */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    a {
        text-decoration: none;
        color: #000;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }
    
    .mobile-hide {
        display: none !important;
    }
}

/* Desktop Optimizations */
@media (min-width: 769px) {
    .desktop-hide {
        display: none !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary: #d95000;
        --secondary: #e07000;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        --gray-50: #111827;
        --gray-100: #1f2937;
        --gray-200: #374151;
        --gray-300: #4b5563;
        --gray-400: #6b7280;
        --gray-500: #9ca3af;
        --gray-600: #d1d5db;
        --gray-700: #e5e7eb;
        --gray-800: #f3f4f6;
        --gray-900: #f9fafb;
    }
}
