/**
 * Wallpaper Website - Custom Styles
 * Bootstrap 5 + Font Awesome
 */

/* ========================================
   CSS Variables
======================================== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-dark: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* ========================================
   Base Styles
======================================== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: var(--dark-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
}

/* ========================================
   Hero Section
======================================== */
.hero-section {
    background: var(--gradient-primary);
    color: white;
}

.hero-section h1 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   Media Cards
======================================== */
.media-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.media-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.media-card-link {
    text-decoration: none;
    color: inherit;
}

.media-card-image {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: #e9ecef;
}

.media-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.media-card:hover .media-card-image img {
    transform: scale(1.05);
}

.media-type-icon {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.media-card:hover .media-type-icon {
    opacity: 1;
}

.media-card-overlay {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.media-card:hover .media-card-overlay {
    opacity: 1;
}

.media-card .card-body {
    background: white;
}

.media-card .card-title {
    color: var(--dark-color);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ========================================
   Category Cards
======================================== */
.category-card {
    border: 2px solid transparent;
    transition: all var(--transition-normal);
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

/* ========================================
   Media Detail Page
======================================== */
.media-preview {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.media-preview img,
.media-preview video {
    max-height: 70vh;
    object-fit: contain;
}

.audio-preview {
    border-radius: 12px;
}

/* Video Container - Disable Download & Context Menu */
.video-container {
    position: relative;
    background: #000;
}

.video-container video {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.video-container video::-webkit-media-controls-enclosure {
    -webkit-app-region: no-drag;
}

/* Hide download button in Chrome/Safari */
.video-container video::-internal-media-controls-download-button {
    display: none;
}

.video-container video::-webkit-media-controls-panel {
    -webkit-user-select: none;
}

.video-container video::-webkit-media-controls-download-button {
    display: none;
}

.stat-item {
    padding: 1rem;
}

.stat-item i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ========================================
   Buttons
======================================== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.like-btn.liked {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* ========================================
   Navigation
======================================== */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-logo {
    height: 60px;
    width: auto;
    max-height: 70px;
    max-width: 250px;
    object-fit: contain;
}

@media (max-width: 767.98px) {
    .navbar-logo {
        height: 45px;
        max-width: 180px;
    }
    
    .navbar-brand {
        width: auto;
        padding: 0;
    }
}

.dropdown-menu {
    border: none;
    box-shadow: var(--card-hover-shadow);
    border-radius: 8px;
}

.dropdown-item:hover {
    background-color: var(--light-color);
}

/* ========================================
   Breadcrumb
======================================== */
.breadcrumb {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ========================================
   Cards
======================================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* ========================================
   Pagination
======================================== */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: var(--dark-color);
    background: white;
    box-shadow: var(--card-shadow);
}

.page-link:hover {
    background: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background: var(--primary-color);
}

.page-item.disabled .page-link {
    background: var(--light-color);
    color: var(--secondary-color);
}

/* ========================================
   Footer
======================================== */
.site-footer {
    margin-top: auto;
}

.site-footer a:hover {
    color: white !important;
}

.social-links a {
    font-size: 1.25rem;
    transition: opacity var(--transition-fast);
}

.social-links a:hover {
    opacity: 0.8;
}

/* ========================================
   Ad Slots
======================================== */
.ad-slot {
    min-height: 90px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    outline: 1px solid #000;
    margin: 1rem 0;
}

.ad-slot:empty::before {
    content: 'Advertisement';
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.adblock-fallback {
    min-height: 90px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px dashed #adb5bd;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    outline: 1px solid #000;
    border-radius: 8px;
    padding: 1.5rem;
}

.adblock-fallback p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* Show fallback when ad is blocked */
.ad-slot .adblock-fallback {
    display: flex !important;
}

.ad-slot ins.adsbygoogle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.mobile-sticky-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    padding: 0.5rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Modal
======================================== */
.modal-content {
    background: transparent;
}

#previewImage {
    max-height: 90vh;
    border-radius: 8px;
}

/* ========================================
   Tag Cloud
======================================== */
.tag-cloud .badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    transition: all var(--transition-fast);
}

.tag-cloud .badge:hover {
    background-color: var(--primary-color) !important;
}

/* ========================================
   Section Titles
======================================== */
.section-title {
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 3px;
}

/* ========================================
   Responsive Adjustments
======================================== */
@media (max-width: 767.98px) {
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .media-card-image {
        aspect-ratio: 4 / 3;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .stat-item i {
        font-size: 1.25rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .media-card-image {
        aspect-ratio: 16 / 12;
    }
}

/* ========================================
   Loading States
======================================== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--light-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Lazy Load Fade In
======================================== */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity var(--transition-normal);
}

img[loading="lazy"].loaded,
img[loading="lazy"][src] {
    opacity: 1;
}

/* ========================================
   Scrollbar Styling
======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-color);
}

/* ========================================
   Print Styles
======================================== */
@media print {
    .site-header,
    .site-footer,
    .ad-slot,
    .pagination,
    .like-btn,
    .share-btn {
        display: none !important;
    }
    
    .media-card {
        break-inside: avoid;
    }
}
