/* Gallery Memory Custom Styles */

/* Import Google Font - Sarabun */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --dark-bg: #0f172a;
    --light-bg: #f8fafc;
}

/* Body Styles */
body {
    background: #ffffff;
    min-height: 100vh;
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Gallery Items */
.gallery-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.2) !important;
    border-color: var(--primary-color);
}

.gallery-thumbnail {
    transition: all 0.3s ease;
    width: 100%;
    object-fit: cover;
}

.gallery-thumbnail:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ปุ่มเปิดรูปเต็ม */
.gallery-item .btn-light {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: all 0.3s ease;
}

.gallery-item:hover .btn-light {
    opacity: 1;
}

.gallery-item .btn-light:hover {
    background: white;
    transform: scale(1.1);
}

/* Cards */
.card {
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: #ffffff;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    color: white;
    border: none;
    border-radius: 20px 20px 0 0 !important;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 2rem;
}

/* สไตล์การ์ดข้อมูลสวยๆ */
.info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), #818cf8);
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
}

.info-card .icon-wrapper {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    margin-bottom: 1rem;
}

.info-card .info-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-card .info-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

/* รายการไฟล์อัปโหลด */
#fileList .list-group-item {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

#fileList .list-group-item:hover {
    background-color: #f9fafb;
    border-color: var(--primary-color);
}

#fileList .badge {
    border-radius: 8px;
}
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
}

/* Buttons */
.btn {
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 1.2rem;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-info {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

/* Navbar */
.navbar {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 4px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

.form-control, .form-select {
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:hover, .form-select:hover {
    border-color: var(--primary-color);
}

/* Input Groups */
.input-group-text {
    border-radius: 12px 0 0 12px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border: 2px solid #e2e8f0;
    font-weight: 500;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.5em 1em;
    border-radius: 8px;
    font-size: 0.85em;
}

/* Alerts */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(8, 145, 178, 0.1));
    border-left: 4px solid var(--info-color);
}

/* Login/Register Pages */
.min-vh-100 {
    min-height: 100vh;
}

/* List Group */
.list-group-item {
    border: none;
    border-radius: 12px !important;
    margin-bottom: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.list-group-item:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateX(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.list-group-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Modal */
.modal-content {
    border-radius: 20px;
    border: none;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0 0 20px 20px;
}

/* Image View */
#viewModalImage {
    max-height: 70vh;
    object-fit: contain;
    width: 100%;
    border-radius: 12px;
}

/* Map */
.leaflet-container {
    border-radius: 10px;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    h1, h2, h3, h4 {
        font-size: calc(1.1rem + 0.5vw);
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in {
    animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Table */
.table {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
}

/* Progress Bar */
.progress {
    border-radius: 12px;
    height: 28px;
    background-color: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.progress-bar {
    font-weight: 600;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
}

/* Scrollbar - Modern Style */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border-radius: 10px;
    border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-dark), var(--primary-color));
}

/* Map marker cluster */
.marker-cluster-small {
    background-color: rgba(181, 226, 140, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(110, 204, 57, 0.6);
}

.marker-cluster-medium {
    background-color: rgba(241, 211, 87, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(240, 194, 12, 0.6);
}

.marker-cluster-large {
    background-color: rgba(253, 156, 115, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(241, 128, 23, 0.6);
}

/* Custom shadow */
.shadow-lg {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}

.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Image grid spacing */
.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

/* Modern Glassmorphism Effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Floating Animation */
@keyframes floating {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

/* Pulse Animation for Notifications */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Modern Input Focus Effect */
.form-control:focus, .form-select:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Category Badge Modern Style */
.badge {
    position: relative;
    overflow: hidden;
}

.badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.badge:hover::before {
    left: 100%;
}

/* ========== MASONRY GALLERY STYLES ========== */
.date-group {
    margin-bottom: 3rem;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 1.5rem;
}

.date-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-transform: capitalize;
}

.date-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--bg-tertiary) 70%, transparent);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.masonry-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    grid-auto-flow: dense;
}

.masonry-item {
    display: flex;
    flex-direction: column;
}

.masonry-card {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-medium);
}

.masonry-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.masonry-image {
    width: 100%;
    height: 250px;
    display: block;
    object-fit: cover;
    cursor: pointer;
    transition: transform var(--transition-medium);
}

.masonry-card:hover .masonry-image {
    transform: scale(1.05);
}

.masonry-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.masonry-checkbox {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 3;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.masonry-card:hover .masonry-checkbox,
.masonry-checkbox:has(.image-select-checkbox:checked) {
    opacity: 1;
}

.masonry-checkbox .form-check-input {
    width: 24px;
    height: 24px;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.masonry-checkbox .form-check-input:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.masonry-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.75) 0%,
        rgba(0, 0, 0, 0.4) 40%,
        transparent 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
    opacity: 0;
    transition: opacity var(--transition-medium);
    z-index: 1;
}

.masonry-card:hover .masonry-overlay {
    opacity: 1;
}

.masonry-title {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
}

.masonry-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.masonry-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.masonry-btn:hover {
    background: #ffffff;
    transform: scale(1.1);
    color: var(--accent-primary);
}

.masonry-btn:active {
    transform: scale(0.95);
}

@media (max-width: 1200px) {
    .masonry-gallery {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .masonry-image {
        height: 220px;
    }
}

@media (max-width: 768px) {
    .masonry-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .masonry-image {
        height: 180px;
    }
    
    .date-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .masonry-overlay {
        opacity: 1;
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.6) 0%,
            transparent 60%
        );
    }
}

@media (max-width: 576px) {
    .masonry-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }
    
    .masonry-image {
        height: 150px;
    }
    
    .masonry-title {
        font-size: 0.8rem;
    }
    
    .masonry-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}
