/* static/css/upload_gallery.css - Redesigned to fill available space */

/* --- Main Wrapper --- */
.upload-gallery-redesign-wrapper {
    background-color: var(--dark-bg);
    padding: 2.5rem 1.5rem;
    min-height: calc(100vh - 120px);
}

.upload-tab-container {
    position: relative;
}

/* --- Upload Feedback Area --- */
.upload-feedback-area {
    margin-bottom: 2rem;
    text-align: center;
}
#upload-progress-area .status-message {
     text-align: right;
     direction: rtl;
     background-color: var(--dark-bg-secondary);
     border: 1px solid var(--card-border);
     color: var(--medium-text);
}
#upload-progress-area .status-message.success {
    color: var(--light-text);
    background-color: #166534;
}
#upload-progress-area .status-message.error {
    color: var(--light-text);
    background-color: #991b1b;
}

/* --- Gallery Section --- */
.gallery-section {
    background-color: transparent;
    padding: 0;
}

#gallery.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    padding: 0;
    direction: rtl;
}

/* --- Image Card Styling --- */
.image-container {
    background-color: var(--card-bg, white);
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.image-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

.image-card-content {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    min-height: 220px;
}

.image-container img {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
    background-color: #f3f4f6;
    border-radius: 8px;
    cursor: zoom-in;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.image-container .image-actions button {
    flex-grow: 1;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    background: #111827;
    color: white;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hover Effect for standard buttons */
.image-container .image-actions button:not(.delete-button):hover {
    background: #374151;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Hover Effect for the delete button */
.image-container .image-actions .delete-button:hover {
    background: #ef4444;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* Disabled State for buttons */
.image-container .image-actions button:disabled {
    background: #9ca3af;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}


/* Gallery Messages (Loading, Empty) */
.gallery-message {
    text-align: center;
    color: var(--medium-text);
    margin-top: 40px;
    padding: 3rem;
    background-color: var(--dark-bg-secondary);
    border: 1px dashed var(--card-border);
    border-radius: 12px;
    grid-column: 1 / -1;
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Floating Action Button */
.upload-fab-button {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 64px;
    background: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-fab-button i {
    line-height: 1;
    padding: 0;
    margin: 0;
}
.upload-fab-button:hover {
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 12px 30px rgba(236, 72, 153, 0.5);
}
.upload-fab-button:disabled {
    background: #4b5563;
    transform: translateX(-50%);
    box-shadow: none;
}


/* START OF MODIFIED CODE */
/* This rule styles the modal's container, making it a fixed overlay
   that centers its content relative to the entire viewport. */
#uploadCategoryModal {
    /* Positioning to cover the whole screen */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050; /* Ensure it's on top */

    /* Flexbox properties for centering the child dialog */
    display: flex; /* This is already set by JS, but we declare it here for clarity */
    align-items: center;
    justify-content: center;

    /* Visual improvements for a more modern look */
    background-color: rgba(17, 24, 39, 0.7); /* Darker, consistent overlay */
    backdrop-filter: blur(4px);
}
/* END OF MODIFIED CODE */


/* --- START OF MODIFICATION: Category Modal Text Color --- */
#uploadCategoryModal .modal-dialog {
    background-color: var(--card-bg);
    color: #111827; /* Default text color for the dialog */
    border: none;
    max-width: 450px;
    width: 90%;
    padding: 2rem;
    text-align: right;
}

#uploadCategoryModal h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #111827; /* Strong black for the header */
    font-size: 1.5rem;
    font-weight: 900;
}
#uploadCategoryModal p {
    font-size: 1rem;
    color: #1f2937; /* Dark gray for paragraph text, for strong readability */
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-align: center;
}
#uploadCategoryForm .form-group {
    margin-bottom: 1.5rem;
}
#uploadCategoryForm label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    color: #111827; /* Strong black for labels */
}
#uploadCategoryForm select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    color: #111827; /* Text inside the select box */
}
#uploadCategoryForm select:focus {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
    outline: none;
}
#uploadCategoryForm button[type="submit"] {
    width: 100%;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}
/* --- END OF MODIFICATION --- */


/* Responsive adjustments */
@media (max-width: 767px) {
    .upload-gallery-redesign-wrapper { padding: 1.5rem 1rem; }
    #gallery.image-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
    .image-container { padding: 0.75rem; }

    /* --- START OF MODIFICATION --- */
    /* Reduce image card height on mobile devices */
    .image-card-content {
        min-height: 150px;
    }

    .image-container img {
        max-height: 150px;
    }
    /* --- END OF MODIFICATION --- */
}

@media (max-width: 480px) {
    #gallery.image-gallery-grid { grid-template-columns: 1fr 1fr; }

    .image-actions {
        flex-direction: column;
        align-items: center;
    }

    .image-container .image-actions button {
        width: 90%;
    }
}