/**
 * Banner Management System CSS
 * Responsive banner display styles
 */

/* Banner Section Container */
.banner-section {
    max-width: 1040px;
    width: 100%;
    margin: 10px auto;
    padding: 0 1rem;
}

.banner-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Banner Grid for Multiple Banners */
.banner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

/* Single Banner Item */
.banner-item {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.banner-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.banner-link {
    display: block;
    width: 100%;
    text-decoration: none;
    position: relative;
}

/* Banner Images - Responsive Display */
.banner-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Desktop Images (1200x300) - Default */
.banner-desktop {
    display: block;
}

.banner-tablet-landscape,
.banner-tablet-portrait,
.banner-mobile {
    display: none;
}

/* Tablet Landscape (992x250) */
@media (max-width: 1200px) and (min-width: 993px) {
    .banner-desktop {
        display: none;
    }

    .banner-tablet-landscape {
        display: block;
    }

    .banner-tablet-portrait,
    .banner-mobile {
        display: none;
    }
}

/* Tablet Portrait (768x200) */
@media (max-width: 992px) and (min-width: 769px) {

    .banner-desktop,
    .banner-tablet-landscape {
        display: none;
    }

    .banner-tablet-portrait {
        display: block;
    }

    .banner-mobile {
        display: none;
    }
}

/* Mobile (576x150) */
@media (max-width: 768px) {

    .banner-desktop,
    .banner-tablet-landscape,
    .banner-tablet-portrait {
        display: none;
    }

    .banner-mobile {
        display: block;
    }

    /* Mobile: Single column layout */
    .banner-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .banner-section {
        padding: 0 0.5rem;
        margin: 1rem 0;
    }
}

/* Single Banner Styles */
.banner-single {
    width: 100%;
}

.banner-single .banner-image {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Multiple Banner Styles */
.banner-multiple {
    width: 100%;
}

/* Banner Images - Full Width, Auto Height */
.banner-desktop,
.banner-tablet-landscape,
.banner-tablet-portrait,
.banner-mobile {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Responsive Adjustments */
@media (max-width: 768px) {

    /* Adjust grid for mobile */
    .banner-grid {
        grid-template-columns: 1fr;
    }
}

/* Banner Loading States */
.banner-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Banner Error States */
.banner-item.error {
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Banner Overlay Effects */
.banner-link::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0, 0, 0, 0.1) 0%, transparent 50%, rgba(0, 0, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.banner-item:hover .banner-link::after {
    opacity: 1;
}

/* Banner Section Spacing */
.banner-section+.banner-section {
    margin-top: 3rem;
}

/* Inline Banner in Products Grid */
.banner-inline {
    grid-column: 1 / -1;
    /* Span full width of grid */
    margin: 1.5rem 0;
    padding: 0 1rem;
}

.banner-inline .banner-section {
    margin: 0;
    padding: 0;
    max-width: none;
}

.banner-inline .banner-container {
    max-width: 100%;
}

.banner-inline .banner-item {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.banner-inline .banner-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Banner visibility control for different screen sizes */
.banner-desktop-only {
    display: block;
}

.banner-mobile-only {
    display: none;
}

/* Responsive inline banner */
@media (max-width: 768px) {
    .banner-inline {
        margin: 1rem 0;
        padding: 0 0.5rem;
    }

    .banner-inline .banner-item {
        border-radius: 8px;
    }

    /* Show mobile banners, hide desktop banners on mobile */
    .banner-desktop-only {
        display: none;
    }

    .banner-mobile-only {
        display: block;
    }
}

/* Admin Banner Management Styles */
.banner-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.banner-admin-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.banner-admin-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.banner-admin-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.banner-status-active {
    color: #28a745;
    font-weight: 600;
}

.banner-status-inactive {
    color: #dc3545;
    font-weight: 600;
}

/* Banner Upload Form Styles */
.banner-upload-form {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.banner-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.banner-upload-item {
    text-align: center;
}

.banner-upload-preview {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* Admin Form Styles */
.banner-form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.banner-preview .no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 0.875rem;
}

.banner-preview .no-image i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.banner-meta {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.banner-meta small {
    color: #6c757d;
    font-size: 0.75rem;
}

/* Responsive Admin Styles */
@media (max-width: 768px) {
    .banner-admin-grid {
        grid-template-columns: 1fr;
    }

    .banner-upload-grid {
        grid-template-columns: 1fr;
    }

    .banner-admin-actions {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }
}