/**
 * WinnerSoft Main Stylesheet
 * Using TailwindCSS v3 Play CDN for development
 * For production: Build with Tailwind CLI for optimized CSS
 */

/* Note: Tailwind v3 CSS loaded from jsdelivr CDN */

/* ===========================================
   Tailwind v3 JIT Features (Custom CSS)
   =========================================== */

/* Slate colors (not in pre-built CSS) */
.from-slate-900 { --tw-gradient-from: #0f172a; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(15, 23, 42, 0)); }
.via-blue-900 { --tw-gradient-stops: var(--tw-gradient-from), #1e3a8a, var(--tw-gradient-to, rgba(30, 58, 138, 0)); }
.to-indigo-900 { --tw-gradient-to: #312e81; }

/* Gradient directions */
.bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); }
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
.bg-gradient-to-b { background-image: linear-gradient(to bottom, var(--tw-gradient-stops)); }

/* Opacity modifiers for backgrounds */
.bg-white\/10 { background-color: rgba(255, 255, 255, 0.1); }
.bg-white\/20 { background-color: rgba(255, 255, 255, 0.2); }
.bg-white\/90 { background-color: rgba(255, 255, 255, 0.9); }
.bg-blue-600\/30 { background-color: rgba(37, 99, 235, 0.3); }
.bg-cyan-500\/20 { background-color: rgba(6, 182, 212, 0.2); }
.bg-green-500\/20 { background-color: rgba(34, 197, 94, 0.2); }

/* Opacity modifiers for text */
.text-white\/90 { color: rgba(255, 255, 255, 0.9); }
.text-white\/80 { color: rgba(255, 255, 255, 0.8); }

/* Text colors */
.text-blue-100 { color: #dbeafe; }
.text-blue-200 { color: #bfdbfe; }
.text-blue-300 { color: #93c5fd; }
.text-cyan-300 { color: #67e8f9; }
.text-cyan-400 { color: #22d3ee; }
.text-green-400 { color: #4ade80; }

/* From/To gradient colors */
.from-blue-400 { --tw-gradient-from: #60a5fa; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(96, 165, 250, 0)); }
.to-cyan-400 { --tw-gradient-to: #22d3ee; }
.from-blue-500 { --tw-gradient-from: #3b82f6; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(59, 130, 246, 0)); }
.to-cyan-500 { --tw-gradient-to: #06b6d4; }
.from-blue-600 { --tw-gradient-from: #2563eb; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(37, 99, 235, 0)); }
.to-indigo-700 { --tw-gradient-to: #4338ca; }
.from-cyan-400 { --tw-gradient-from: #22d3ee; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(34, 211, 238, 0)); }

/* Via colors for 3-stop gradients */
.via-blue-700 { --tw-gradient-stops: var(--tw-gradient-from), #1d4ed8, var(--tw-gradient-to, rgba(29, 78, 216, 0)); }

/* Backdrop blur */
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.backdrop-blur { backdrop-filter: blur(8px); }

/* Shadow colors */
.shadow-blue-500\/30 { --tw-shadow-color: rgba(59, 130, 246, 0.3); --tw-shadow: var(--tw-shadow-colored); }

/* Background clip for text gradients */
.bg-clip-text { -webkit-background-clip: text; background-clip: text; }
.text-transparent { color: transparent; }

/* ===========================================
   CSS Variables (Brand Colors)
   =========================================== */
:root {
    --color-primary: #1e3a8a;      /* Blue 900 */
    --color-primary-light: #3b82f6; /* Blue 500 */
    --color-secondary: #f97316;     /* Orange 500 */
    --color-text: #1f2937;          /* Gray 800 */
    --color-text-light: #6b7280;    /* Gray 500 */
    --color-background: #ffffff;
    --color-background-alt: #f9fafb; /* Gray 50 */

    --font-sans: 'Poppins', 'Sarabun', sans-serif;
    --font-thai: 'Sarabun', sans-serif;
}

/* ===========================================
   Base Styles
   =========================================== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    line-height: 1.6;
}

/* Thai language specific */
html[lang="th"] body {
    font-family: var(--font-thai);
}

/* ===========================================
   Typography
   =========================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

/* ===========================================
   Animations
   =========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.animate-slide-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

/* Stagger animation delays */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-400 { animation-delay: 0.4s; }
.animate-delay-500 { animation-delay: 0.5s; }

/* ===========================================
   Header Styles
   =========================================== */
#main-header {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

#main-header.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Dropdown Menu Styles */
.group .dropdown-open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.group > a svg {
    transition: transform 0.2s ease;
}

.group > a svg.rotate-180 {
    transform: rotate(180deg);
}

/* Mobile dropdown arrow */
.dropdown-arrow {
    float: right;
    margin-left: auto;
    transition: transform 0.2s ease;
}

/* ===========================================
   Button Styles
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--color-secondary);
    color: white;
}

.btn-primary:hover {
    background-color: #ea580c;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background-color: white;
    color: var(--color-primary);
}

/* ===========================================
   Card Styles
   =========================================== */
.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ===========================================
   Form Styles
   =========================================== */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

/* ===========================================
   Breadcrumbs
   =========================================== */
.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumbs .separator {
    color: #9ca3af;
}

.breadcrumbs a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--color-primary-light);
}

/* ===========================================
   Lazy Loading Images
   =========================================== */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.lazy[src]:not([src^="data:"]) {
    opacity: 1;
}

/* ===========================================
   Scroll to Top Button
   =========================================== */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background-color: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 40;
    cursor: pointer;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-4px);
}

/* ===========================================
   Screen Reader Only
   =========================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    header,
    footer,
    .scroll-to-top,
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* ===========================================
   Responsive Utilities
   =========================================== */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }
}

/* ===========================================
   Custom Scrollbar
   =========================================== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
