/* Gallery Index Styles */

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

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Raleway', sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

/* Hero Section */
.gallery-hero {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    padding: 70px 0px 30px 0px;
}

.gallery-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.3;
}

.hero-content {
    text-align: center;
    color: white;
    z-index: 2;
    position: relative;
    max-width: 800px;
    padding: 0 20px;
}

.hero-logo {
    margin-bottom: 30px;
}

.hero-logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 20px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    margin-bottom: 40px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ccc;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
    border: 2px solid #ccc;
    transition: all 0.3s ease;
}

.hero-btn:hover {
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.hero-btn span {
    font-size: 1.5rem;
    font-weight: 300;
}

/* Search Container */
.search-container {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 5px;
    backdrop-filter: blur(10px);
    border: 2px solid #ccc;
    max-width: 400px;
    width: 100%;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    padding: 12px 20px;
    font-size: 1rem;
    font-family: 'Raleway', sans-serif;
    color: #333;
}

.search-input::placeholder {
    color: #333;
}

.search-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Clear Search Button */
.clear-search-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 5px;
}

.clear-search-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #bbd2c5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-indicator span {
    font-size: 1rem;
    font-weight: 500;
}

/* End of Results */
.end-of-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 1rem;
    font-weight: 500;
    border-top: 1px solid #eee;
    margin-top: 40px;
}

/* Gallery Container */
.gallery-container {
    padding: 0px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    margin-bottom: 60px;
}

/* Gallery Item */
.gallery-item {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    position: relative;
    cursor: grab;
}

.gallery-item:active {
    cursor: grabbing;
}

/* Drag & Drop Styles */
.gallery-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.gallery-item.drag-over {
    transform: scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 2px dashed #bbd2c5;
}

.gallery-item.drag-placeholder {
    opacity: 0.3;
    transform: scale(0.95);
    border: 2px dashed #ccc;
    background: #f8f9fa;
}

/* Drag Handle */
.drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 0.8rem;
    touch-action: none; /* Prevent default touch behavior */
}

.gallery-item:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Mobile-specific drag handle */
@media (max-width: 768px) {
    .drag-handle {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        opacity: 1 !important; /* Always visible on mobile */
        background: rgba(0, 0, 0, 0.8);
        display: flex !important; /* Force show on mobile */
    }

    .gallery-item:hover .drag-handle {
        opacity: 1 !important;
    }

    .drag-handle:hover {
        background: rgba(0, 0, 0, 0.9);
        transform: scale(1.05);
    }
}

/* Touch-friendly drag states */
.gallery-item.touch-dragging {
    opacity: 0.7;
    transform: scale(1.05);
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.gallery-item.touch-drag-over {
    transform: scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 2px dashed #bbd2c5;
}

/* Mobile reorder buttons */
.mobile-reorder-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.mobile-reorder-controls.show {
    display: flex;
    gap: 15px;
    align-items: center;
}

.mobile-reorder-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.mobile-reorder-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-reorder-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile controls - only show on small mobile screens */
@media (max-width: 768px) {
    .mobile-reorder-controls {
        display: none;
    }

    .mobile-reorder-controls.show {
        display: flex !important;
    }
}

/* Hide mobile controls on tablets and larger screens */
@media (min-width: 769px) {
    .mobile-reorder-controls {
        display: none !important;
    }
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Gallery Banner */
.gallery-banner {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover .banner-img {
    transform: scale(1.05);
}

.banner-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-icon {
    font-size: 4rem;
    opacity: 0.5;
}

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.8) 100%
    );
    display: flex;
    align-items: flex-end;
    padding: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-info {
    color: white;
    width: 100%;
}

.gallery-title {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.photo-count {
    font-weight: 500;
}

.gallery-date {
    font-weight: 300;
}

.gallery-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.delete-btn {
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: 2px solid rgba(220, 53, 69, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.delete-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

.view-btn,
.manage-btn,
.action-btn {
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.action-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

/* Preview Grid */
.preview-grid {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.preview-item {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.preview-item:hover .preview-img {
    transform: scale(1.1);
}

.more-count {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.more-count:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.more-text {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.empty-preview {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    padding: 40px 20px;
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.empty-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.empty-content {
    max-width: 500px;
    padding: 0 20px;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 30px;
    opacity: 0.3;
}

.empty-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.empty-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
    font-weight: 300;
}

.create-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #bbd2c5; /* fallback for old browsers */
    background: -webkit-linear-gradient(
        to right,
        #bbd2c5,
        #536976
    ); /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(
        to right,
        #bbd2c5,
        #536976
    ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    color: white;
    padding: 18px 36px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.create-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.create-btn span {
    font-size: 1.5rem;
    font-weight: 300;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-hero {
        margin: 0px;
        background-attachment: scroll;
    }
    .hero-title {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .gallery-banner {
        height: 250px;
    }

    .gallery-title {
        font-size: 1.5rem;
    }

    .gallery-actions {
        flex-direction: row;
        gap: 10px;
        justify-content: center;
    }

    .delete-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .view-btn,
    .manage-btn {
        text-align: center;
        padding: 10px 20px;
    }

    .preview-grid {
        padding: 20px;
        gap: 10px;
        grid-template-columns: repeat(2, 1fr);
    }

    .empty-title {
        font-size: 2rem;
    }

    .empty-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        padding: 0px 15px;
    }
    .gallery-hero {
        padding: 80px 0px 15px 0px !important;
    
    }
    .search-container {
        margin: 0px 0px 30px 0px !important;
    }

    .hero-title {
        font-size: 2rem;
    }

    .gallery-banner {
        height: 200px;
    }

    .gallery-overlay {
        padding: 20px;
    }

    .gallery-title {
        font-size: 1.3rem;
    }

    .preview-grid {
        padding: 15px;
    }
}

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

.gallery-item {
    animation: fadeInUp 0.6s ease forwards;
}

.gallery-item:nth-child(1) {
    animation-delay: 0.1s;
}
.gallery-item:nth-child(2) {
    animation-delay: 0.2s;
}
.gallery-item:nth-child(3) {
    animation-delay: 0.3s;
}
.gallery-item:nth-child(4) {
    animation-delay: 0.4s;
}
.gallery-item:nth-child(5) {
    animation-delay: 0.5s;
}
.gallery-item:nth-child(6) {
    animation-delay: 0.6s;
}

/* Load More Button */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.load-more-btn {
    background: linear-gradient(135deg, #bbd2c5, #536976);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Raleway', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(187, 210, 197, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    justify-content: center;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(187, 210, 197, 0.4);
    background: linear-gradient(135deg, #a8c4b0, #4a5d6b);
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
