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

/* Page Header */
.page-header {
    padding: 20px 0;
}

.page-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #6c757d;
    font-size: 1.1rem;
    margin: 0;
}

/* Statistics Cards */
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

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

.stat-card.primary {
    border-left-color: var(--primary);
}

.stat-card.success {
    border-left-color: #28a745;
}

.stat-card.warning {
    border-left-color: #ffc107;
}

.stat-card.info {
    border-left-color: #17a2b8;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-card.primary .stat-icon {
    background: var(--gradient);
}

.stat-card.success .stat-icon {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.stat-card.info .stat-icon {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--dark);
    margin: 0;
    line-height: 1;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 5px 0 0 0;
    font-weight: 500;
}

/* Gallery Grid Card */
.gallery-grid-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.gallery-grid-card:hover {
    box-shadow: var(--shadow-lg);
}

.gallery-grid-card .card-header {
    padding: 25px 30px 0;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.gallery-grid-card .card-body {
    padding: 25px 30px 30px;
}

.header-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.header-icon {
    font-size: 1.8rem;
    color: var(--primary);
    margin-right: 15px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.card-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.3rem;
    color: var(--dark);
    margin: 0;
}

.card-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 5px 0 0 0;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 5px;
    background: #f8f9fa;
    padding: 5px;
    border-radius: 8px;
}

.view-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #6c757d;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    background: white;
    color: var(--primary);
}

.view-btn.active {
    background: var(--primary);
    color: white;
}

/* Search Box */
.search-box {
    position: relative;
    min-width: 250px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.1);
    outline: none;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.gallery-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

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

.gallery-image {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

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

.gallery-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 5px;
    flex-direction: column;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-urutan {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.badge-active {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.badge-inactive {
    background: #6c757d;
    color: white;
}

/* Gallery Content */
.gallery-content {
    padding: 20px;
}

.gallery-title {
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.gallery-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 15px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-meta {
    margin-bottom: 15px;
}

.gallery-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Form Switch */
.form-check.form-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.form-check-input {
    width: 3em;
    height: 1.5em;
    margin: 0;
}

.form-check-label {
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 500;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-buttons .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid;
    transition: var(--transition);
}

.btn-edit {
    color: var(--primary);
    border-color: var(--primary) !important;
    background: transparent;
}

.btn-edit:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-view {
    color: #17a2b8;
    border-color: #17a2b8 !important;
    background: transparent;
}

.btn-view:hover {
    background: #17a2b8;
    color: white;
    transform: translateY(-2px);
}

.btn-delete {
    color: #dc3545;
    border-color: #dc3545 !important;
    background: transparent;
}

.btn-delete:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-2px);
}

/* Gallery List View */
.gallery-list .gallery-thumb {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
}

.gallery-list .gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-list .gallery-info h6 {
    margin: 0 0 5px 0;
    font-weight: 600;
}

.gallery-list .gallery-info p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.urutan-badge {
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    padding: 60px 20px;
    text-align: center;
}

.empty-state h4 {
    color: var(--dark);
    margin-bottom: 10px;
    font-weight: 600;
}

.empty-state p {
    color: #6c757d;
    max-width: 400px;
    margin: 0 auto;
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 25px 30px 20px;
}

.modal-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
}

.modal-body {
    padding: 25px 30px;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 20px 30px 25px;
}

/* Gallery Upload Area */
.gallery-upload-area {
    position: relative;
}

.upload-wrapper {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8f9fa;
}

.upload-wrapper:hover {
    border-color: var(--primary);
    background: #f0f4ff;
}

.upload-wrapper.dragover {
    border-color: var(--primary);
    background: #e3f2fd;
}

.upload-placeholder i {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 15px;
}

.upload-placeholder p {
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 10px 0;
}

.upload-placeholder small {
    color: #6c757d;
    line-height: 1.4;
}

.upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Image Preview */
.image-preview {
    position: relative;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 15px;
}

.image-preview img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.btn-remove-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.btn-remove-preview:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* Current Image Preview */
.current-image-preview {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.current-image-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

/* Gallery Detail View */
.gallery-detail-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.gallery-detail-info {
    padding: 20px 0;
}

.detail-item {
    margin-bottom: 15px;
}

.detail-label {
    font-weight: 600;
    color: var(--dark);
    display: block;
    margin-bottom: 5px;
}

.detail-content {
    color: #6c757d;
    margin: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    display: block;
}

.form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    transition: var(--transition);
    font-size: 0.95rem;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--gradient);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 102, 204, 0.3);
}

.btn-secondary {
    background: #6c757d;
    border: none;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .page-header {
        padding: 15px 0;
    }
    
    .page-title {
        font-size: 1.7rem;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 1.7rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .gallery-grid-card .card-header {
        padding: 20px 25px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-content {
        width: 100%;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box {
        min-width: 200px;
    }
}

@media (max-width: 767.98px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-body {
        padding: 20px 25px;
    }
    
    .modal-header,
    .modal-footer {
        padding: 20px 25px;
    }
    
    .gallery-list .table-responsive {
        font-size: 0.9rem;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .gallery-detail-info {
        padding: 15px 0 0 0;
    }
}

@media (max-width: 575.98px) {
    .manajemen-gallery-container {
        padding: 0 15px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .upload-placeholder {
        padding: 30px 15px;
    }
    
    .upload-placeholder i {
        font-size: 2.5rem;
    }
    
    .modal-body .row {
        flex-direction: column;
    }
    
    .modal-body .col-md-6 {
        width: 100%;
    }
    
    .action-buttons {
        justify-content: center;
    }
}