/* ========================================
   UNIVERSAL COMPONENTS - 2KETEVENT
   ใช้ร่วมกันทุกหน้า
======================================== */

/* ========== CATEGORY DROPDOWN ========== */
.category-field,
.admin-category-field,
.organizer-category-field {
    position: relative;
    width: 100%;
}

.category-select,
.admin-category-select,
.organizer-category-select {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.category-selected,
.admin-category-selected,
.organizer-category-selected {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 9px 15px;
    font-size: 14px;
    color: #333;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.category-selected::after,
.admin-category-selected::after,
.organizer-category-selected::after {
    content: "▾";
    color: #ff6b35;
    font-size: 18px;
    font-weight: 700;
    transition: transform 0.3s ease;
}

.category-selected:hover,
.admin-category-selected:hover,
.organizer-category-selected:hover {
    border-color: #ff6b35;
    background: #fff;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.15);
    transform: translateY(-1px);
}

.category-dropdown.show .category-selected::after,
.admin-category-dropdown.show .admin-category-selected::after,
.organizer-category-dropdown.show .organizer-category-selected::after {
    transform: rotate(180deg);
}

/* Dropdown Box */
.category-dropdown,
.admin-category-dropdown,
.organizer-category-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ff6b35;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    z-index: 2000;
    max-height: 420px;
    overflow-y: auto;
    padding: 24px;
    animation: slideDownFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-dropdown.show,
.admin-category-dropdown.show,
.organizer-category-dropdown.show {
    display: block;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Category Groups */
.category-group,
.admin-category-group,
.organizer-category-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f5f5f5;
}

.category-group:last-child,
.admin-category-group:last-child,
.organizer-category-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.category-group h4,
.admin-category-group h4,
.organizer-category-group h4 {
    font-size: 12px;
    font-weight: 800;
    color: #ff6b35;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ffe5d9;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-group ul,
.admin-category-group ul,
.organizer-category-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.category-group li,
.admin-category-group li,
.organizer-category-group li {
    padding: 10px 14px;
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1a1a1a;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.category-group li::before,
.admin-category-group li::before,
.organizer-category-group li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ff6b35, #ff8c42);
    transition: width 0.3s ease;
    z-index: -1;
    border-radius: 10px;
}

.category-group li:hover,
.admin-category-group li:hover,
.organizer-category-group li:hover {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe5d9 100%);
    color: #ff6b35;
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.15);
}

.category-group li:hover::before,
.admin-category-group li:hover::before,
.organizer-category-group li:hover::before {
    width: 4px;
}

/* Scrollbar */
.category-dropdown::-webkit-scrollbar,
.admin-category-dropdown::-webkit-scrollbar,
.organizer-category-dropdown::-webkit-scrollbar {
    width: 8px;
}

.category-dropdown::-webkit-scrollbar-track,
.admin-category-dropdown::-webkit-scrollbar-track,
.organizer-category-dropdown::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 10px;
}

.category-dropdown::-webkit-scrollbar-thumb,
.admin-category-dropdown::-webkit-scrollbar-thumb,
.organizer-category-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    border-radius: 10px;
    border: 2px solid #f8f9fa;
}

.category-dropdown::-webkit-scrollbar-thumb:hover,
.admin-category-dropdown::-webkit-scrollbar-thumb:hover,
.organizer-category-dropdown::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff5722, #ff6b35);
}

/* ========== LOCATION DROPDOWN ========== */
.location-wrapper,
.admin-location-wrapper,
.organizer-location-wrapper {
    position: relative;
}

.location-dropdown,
.admin-location-dropdown,
.organizer-location-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ff6b35;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    z-index: 2000;
    display: none;
    max-height: 380px;
    overflow: hidden;
    overflow-y: auto;
    animation: slideDownFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.location-dropdown.show,
.admin-location-dropdown.show,
.organizer-location-dropdown.show {
    display: block;
}

.location-dropdown-content,
.admin-location-dropdown-content,
.organizer-location-dropdown-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 24px;
}

.location-column,
.admin-location-column,
.organizer-location-column {
    display: flex;
    flex-direction: column;
}

.location-column h4,
.admin-location-column h4,
.organizer-location-column h4 {
    font-size: 12px;
    font-weight: 800;
    color: #ff6b35;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ffe5d9;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-list,
.admin-location-list,
.organizer-location-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.location-item,
.admin-location-item,
.organizer-location-item {
    padding: 10px 14px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.location-item::before,
.admin-location-item::before,
.organizer-location-item::before {
    content: "📍";
    font-size: 14px;
    transition: transform 0.3s ease;
}

.location-item:hover,
.admin-location-item:hover,
.organizer-location-item:hover {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe5d9 100%);
    color: #ff6b35;
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.15);
}

.location-item:hover::before,
.admin-location-item:hover::before,
.organizer-location-item:hover::before {
    transform: scale(1.2);
}

.location-popular,
.admin-location-popular,
.organizer-location-popular {
    background: linear-gradient(135deg, #fff8f3 0%, #ffe5d9 100%);
    font-weight: 700;
}

.location-popular::after,
.admin-location-popular::after,
.organizer-location-popular::after {
    content: "🔥";
    font-size: 14px;
    margin-left: auto;
    animation: flame 1.5s ease-in-out infinite;
}

@keyframes flame {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Scrollbar */
.location-dropdown::-webkit-scrollbar,
.admin-location-dropdown::-webkit-scrollbar,
.organizer-location-dropdown::-webkit-scrollbar {
    width: 8px;
}

.location-dropdown::-webkit-scrollbar-track,
.admin-location-dropdown::-webkit-scrollbar-track,
.organizer-location-dropdown::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 10px;
}

.location-dropdown::-webkit-scrollbar-thumb,
.admin-location-dropdown::-webkit-scrollbar-thumb,
.organizer-location-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    border-radius: 10px;
    border: 2px solid #f8f9fa;
}

/* ========== IMAGE UPLOAD SECTION ========== */
.image-upload-section {
    margin-top: 15px;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.image-preview-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid #e0e0e0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    aspect-ratio: 16/9;
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.image-preview-item:hover {
    border-color: #ff6b35;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.25);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.image-preview-item:hover img {
    transform: scale(1.05);
}

.image-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-item:hover .image-preview-overlay {
    opacity: 1;
}

.btn-image-action {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-image-delete {
    background: linear-gradient(135deg, #ff6b35 0%, #ff5722 100%);
}

.btn-image-delete:hover {
    background: linear-gradient(135deg, #ff5722 0%, #ff4500 100%);
    transform: scale(1.1) rotate(-2deg);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.btn-image-upload {
    border: 3px dashed #e0e0e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    position: relative;
    overflow: hidden;
}

.btn-image-upload::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe5d9 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-image-upload:hover {
    border-color: #ff6b35;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.15);
}

.btn-image-upload:hover::before {
    opacity: 1;
}

.btn-image-upload input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(255, 107, 53, 0.3));
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.btn-image-upload>div {
    position: relative;
    z-index: 1;
}

.image-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #ff6b35 0%, #ff5722 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
    }
}

/* ========== MODAL IMPROVEMENTS ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #ffffff;
    margin: 3% auto;
    border-radius: 24px;
    width: 92%;
    max-width: 900px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
    animation: slideUpBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

@keyframes slideUpBounce {
    0% {
        opacity: 0;
        transform: translateY(100px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
    padding: 28px 35px;
    border-radius: 24px 24px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
}

.modal-header h2 {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 26px;
    color: #000000;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    pointer-events: auto;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.253);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;backdrop-filter: blur(10px); color: white;
}

.close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}



/* ========== BUTTON STYLES ========== */
.btn,
.btn-action,
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: none;
    letter-spacing: 0.3px;
}

.btn::before,
.btn-action::before,
.btn-primary::before,
.btn-secondary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
}

.btn:hover::before,
.btn-action:hover::before,
.btn-primary:hover::before,
.btn-secondary:hover::before {
    left: 0;
}

.btn:hover,
.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn:active,
.btn-action:active {
    transform: translateY(0);
}

/* Primary Button (Green) */
.btn-refresh,
.btn-primary {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.btn-refresh:hover,
.btn-primary:hover {
    background: linear-gradient(135deg, #3ad66d 0%, #2ee1c9 100%);
}

/* Secondary Button (Orange) */
.btn-clear,
.btn-delete,
.btn-secondary {
    background: linear-gradient(135deg, #ff6b35 0%, #ff5722 100%);
    color: white;
}

.btn-clear:hover,
.btn-delete:hover,
.btn-secondary:hover {
    background: linear-gradient(135deg, #ff5722 0%, #ff4500 100%);
}

/* Export/Info Button (Blue) */
.btn-export,
.btn-edit {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
}

.btn-export:hover,
.btn-edit:hover {
    background: linear-gradient(135deg, #357abd 0%, #2868a8 100%);
}

/* Create New Button */
.btn-create-new {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
}

.btn-create-new:hover {
    background: linear-gradient(135deg, #5568d3 0%, #623c91 100%);
}

/* Disabled State */
.btn:disabled,
.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {

    .location-dropdown-content,
    .admin-location-dropdown-content,
    .organizer-location-dropdown-content {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px;
    }

    .category-dropdown,
    .admin-category-dropdown,
    .organizer-category-dropdown {
        max-height: 320px;
        padding: 18px;
    }

    .image-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .modal-content {
        width: 96%;
        margin: 5% auto;
        max-height: 90vh;
    }

    .modal-header {
        padding: 20px 24px;
    }

    .modal-header h2 {
        font-size: 22px;
    }

    .close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .btn-image-upload {
        min-height: 140px;
        padding: 30px 15px;
    }

    .upload-icon {
        font-size: 36px;
    }

    .image-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   TEXTAREA AND TEXT DISPLAY - PRE-WRAP
   รองรับการเว้นวรรคและขึ้นบรรทัดใหม่
======================================== */

/* Global textarea formatting */
textarea {
    white-space: pre-wrap;
}

/* Elements that display description or address text */
[data-description],
[data-address],
.event-description,
.event-address,
.description-display,
.address-display,
p.description,
p.address,
div.description,
div.address {
    white-space: pre-wrap;
}