/**
 * Landing Page - Main Styles
 * Modern, Premium Design
 */

/* ==================== Reset & Base ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #2563eb;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ==================== Background Animations ==================== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Particles */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Gradient Animation */
.gradient-animation {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Waves Animation */
.waves-animation {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25vh;
    min-height: 100px;
    max-height: 200px;
}

.waves {
    position: absolute;
    width: 100%;
    height: 100%;
    margin-bottom: -7px;
    min-height: 100px;
    max-height: 200px;
}

.parallax>use {
    animation: wave 25s cubic-bezier(.55, .5, .45, .5) infinite;
}

.parallax>use:nth-child(1) {
    animation-delay: -2s;
    animation-duration: 7s;
}

.parallax>use:nth-child(2) {
    animation-delay: -3s;
    animation-duration: 10s;
}

.parallax>use:nth-child(3) {
    animation-delay: -4s;
    animation-duration: 13s;
}

.parallax>use:nth-child(4) {
    animation-delay: -5s;
    animation-duration: 20s;
}

@keyframes wave {
    0% {
        transform: translate3d(-90px, 0, 0);
    }

    100% {
        transform: translate3d(85px, 0, 0);
    }
}

/* Rain Animation */
.rain-animation {
    overflow: hidden;
}

.rain-drop {
    position: absolute;
    top: -20px;
    width: 2px;
    height: 15px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.6));
    animation: rainFall linear infinite;
}

@keyframes rainFall {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(100vh);
    }
}

/* Snow Animation */
.snow-animation {
    overflow: hidden;
}

.snow-flake {
    position: absolute;
    top: -30px;
    color: rgba(255, 255, 255, 0.8);
    animation: snowFall linear infinite;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

@keyframes snowFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* Stars Animation */
.stars-animation {
    overflow: hidden;
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: twinkle ease-in-out infinite;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Bubbles Animation */
.bubbles-animation {
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -50px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.4);
    animation: bubbleRise ease-in-out infinite;
}

@keyframes bubbleRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-100vh) scale(0.5);
        opacity: 0;
    }
}

/* Fireflies Animation */
.fireflies-animation {
    overflow: hidden;
}

.firefly {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffff00;
    border-radius: 50%;
    box-shadow: 0 0 10px 5px rgba(255, 255, 0, 0.6), 0 0 20px 10px rgba(255, 255, 0, 0.3);
    animation: fireflyGlow ease-in-out infinite, fireflyMove ease-in-out infinite;
}

@keyframes fireflyGlow {

    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes fireflyMove {

    0%,
    100% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(20px, -15px);
    }

    50% {
        transform: translate(-10px, 10px);
    }

    75% {
        transform: translate(-20px, -5px);
    }
}

/* Matrix Animation */
.matrix-animation {
    background: black;
}

/* ==================== Main Content ==================== */
.main-content {
    position: relative;
    z-index: 1;
    padding-bottom: 100px;
    /* Space for fixed buttons */
}

.images-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.image-link {
    display: block;
    width: 100%;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.image-link:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

.product-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Placeholder boxes for demo */
.no-images {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 20px;
}

.placeholder-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 4px solid #4ade80;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #666;
    text-align: center;
    padding: 20px;
}

/* ==================== Fixed Buttons ==================== */
.fixed-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    z-index: 1000;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-register {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    color: #1f2937;
}

.btn-register:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 50%, #f59e0b 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
}

.btn-line {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    color: white;
}

.btn-line:hover {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 50%, #16a34a 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

/* ==================== Button Animations ==================== */
.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(251, 191, 36, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0);
    }
}

.glow-animation {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px rgba(34, 197, 94, 0.5), 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    to {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.8), 0 0 30px rgba(34, 197, 94, 0.4), 0 4px 15px rgba(0, 0, 0, 0.3);
    }
}

/* ==================== Responsive Design ==================== */

/* Mobile - เต็มจอ */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .main-content {
        padding-bottom: 90px;
    }

    .images-container {
        max-width: 100%;
        gap: 0;
    }

    .image-link:hover {
        transform: none;
        filter: none;
    }

    .product-image {
        width: 100%;
    }

    .placeholder-box {
        aspect-ratio: 4 / 5;
    }

    .fixed-buttons {
        padding: 12px 15px;
        gap: 10px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        flex: 1;
        max-width: 180px;
    }

    .btn-icon {
        font-size: 1rem;
    }
}

/* Desktop */
@media (min-width: 769px) {
    body {
        padding: 20px;
    }

    .images-container {
        gap: 15px;
        padding: 20px;
    }

    .image-link {
        border-radius: 8px;
        overflow: hidden;
    }

    .placeholder-box {
        border-radius: 8px;
    }
}

/* Large screens */
@media (min-width: 1200px) {
    .images-container {
        max-width: 700px;
    }

    .btn {
        padding: 16px 36px;
        font-size: 1.1rem;
    }
}

/* ==================== Admin Styles ==================== */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.admin-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.admin-header h1 {
    color: white;
    font-size: 2rem;
    margin-bottom: 10px;
}

.admin-header p {
    color: rgba(255, 255, 255, 0.8);
}

.admin-nav {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255, 255, 255, 0.3);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.views {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
}

.stat-icon.clicks {
    background: linear-gradient(135deg, #dcfce7 0%, #86efac 100%);
}

.stat-info h3 {
    font-size: 2rem;
    color: #1e3a8a;
    margin-bottom: 5px;
}

.stat-info p {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Admin Cards */
.admin-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.admin-card h2 {
    font-size: 1.3rem;
    color: #1e3a8a;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: #9ca3af;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236b7280'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 24px;
    padding-right: 44px;
}

/* Color picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.color-picker {
    appearance: none;
    width: 60px;
    height: 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
}

.color-value {
    font-family: monospace;
    font-size: 1rem;
    color: #4b5563;
}

/* File Upload */
.file-upload-area {
    border: 3px dashed #d1d5db;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f9fafb;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.file-upload-area .icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.file-upload-area p {
    color: #6b7280;
}

.file-upload-area .subtitle {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 8px;
}

input[type="file"] {
    display: none;
}

/* Images Gallery */
.images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.image-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-item .image-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.image-item .image-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    padding: 30px 10px 10px;
    display: flex;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-item:hover .image-actions {
    opacity: 1;
}

.image-actions button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.image-actions button:hover {
    transform: scale(1.1);
}

.btn-delete {
    background: #ef4444;
    color: white;
}

/* Submit Button */
.btn-submit {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.btn-submit:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* Alert Messages */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #60a5fa 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #1e3a8a;
    font-size: 1.8rem;
}

.login-box .logo {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 20px;
}

/* Radio/Checkbox styles */
.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.option-item {
    position: relative;
}

.option-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-item input:checked+label {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.option-item label:hover {
    border-color: #93c5fd;
}

/* Preview Section */
.preview-section {
    margin-top: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 12px;
}

.preview-section h4 {
    margin-bottom: 10px;
    color: #374151;
}

/* Responsive Admin */
@media (max-width: 768px) {
    .admin-container {
        padding: 15px;
    }

    .admin-header {
        padding: 20px;
    }

    .admin-header h1 {
        font-size: 1.5rem;
    }

    .admin-nav {
        flex-wrap: wrap;
    }

    .admin-nav a {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .images-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .login-box {
        padding: 30px 20px;
    }
}