/* Font Face Declarations */
@font-face {
    font-family: 'IRANYekan';
    src: url('fonts/iranyekanwebthinfanum.woff') format('woff');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekan';
    src: url('fonts/iranyekanweblightfanum.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekan';
    src: url('fonts/iranyekanwebregularfanum.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekan';
    src: url('fonts/iranyekanwebmediumfanum.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekan';
    src: url('fonts/iranyekanwebboldfanum.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekan';
    src: url('fonts/iranyekanwebextraboldfanum.woff') format('woff');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IRANYekan';
    src: url('fonts/iranyekanwebblackfanum.woff') format('woff');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables for Theme */
:root {
    /* Light Theme Colors */
    --bg-primary: linear-gradient(135deg, #eff7fd 0%, #00b4ff 100%);
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-tertiary: rgba(255, 255, 255, 0.9);
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --text-quaternary: #bbb;
    --accent-color: #0093ff;
    --accent-hover: #00b4ff;
    --accent-light: #0080ff;
    --accent-dark: #0066cc;
    --accent-darker: #0073e6;
    --border-color: #e1e5e9;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --card-bg: white;
    --modal-bg: white;
    --overlay-bg: rgba(0, 0, 0, 0.9);
}

/* Dark Theme Colors */
[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: rgba(30, 30, 46, 0.95);
    --bg-tertiary: rgba(40, 40, 60, 0.9);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #888888;
    --text-quaternary: #666666;
    --accent-color: #4a9eff;
    --accent-hover: #6bb6ff;
    --accent-light: #3d8bff;
    --accent-dark: #3578e6;
    --accent-darker: #2c63cc;
    --border-color: #404060;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --card-bg: #2a2a3e;
    --modal-bg: #2a2a3e;
    --overlay-bg: rgba(0, 0, 0, 0.95);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    direction: rtl;
    font-family: 'IRANYekan', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    font-weight: 400;
    transition: all 0.3s ease;
}

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

/* Header Styles */
.header {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1;
    transition: all 0.3s ease;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: var(--accent-color);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.theme-toggle:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-hover);
}

.theme-toggle:active {
    transform: translateY(0);
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.logo i {
    font-size: 2.2rem;
}

.search-container {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: 'IRANYekan', sans-serif;
    font-weight: 400;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 147, 255, 0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
    font-size: 18px;
    transition: all 0.3s ease;
}

/* Navigation Styles */
.navigation {
    background: var(--bg-tertiary);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.nav-list {
    display: flex;
    list-style: none;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 0;
}

.nav-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
    justify-content: center;
    font-family: 'IRANYekan', sans-serif;
}

.nav-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.nav-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.nav-btn i {
    font-size: 16px;
}

/* Main Content */
.main {
    padding: 40px 0;
    min-height: calc(100vh - 200px);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.video-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px var(--shadow-hover);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    background: linear-gradient(45deg, var(--accent-color), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.thumbnail-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.video-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-card:hover .video-thumbnail::before {
    opacity: 1;
}

.thumbnail-emoji {
    position: relative;
    z-index: 2;
}

.play-button {
    position: absolute;
    top: 25%;
    right: 1%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 3;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.video-card:hover .play-button {
    background: var(--accent-color);
    color: white;
    transform: translate(-50%, -50%) scale(1.1);
}

.video-info {
    padding: 20px;
}

.video-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
    font-family: 'IRANYekan', sans-serif;
    transition: all 0.3s ease;
}

.video-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    font-family: 'IRANYekan', sans-serif;
    font-weight: 400;
    transition: all 0.3s ease;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-tertiary);
    transition: all 0.3s ease;
}

.video-categories {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.video-duration {
    background: var(--border-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-family: 'IRANYekan', sans-serif;
    transition: all 0.3s ease;
}

.video-category {
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-family: 'IRANYekan', sans-serif;
    transition: all 0.3s ease;
    font-size: 10px;
    white-space: nowrap;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.no-results i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-tertiary);
    font-family: 'IRANYekan', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
}

.no-results p {
    font-size: 16px;
    color: var(--text-quaternary);
    font-family: 'IRANYekan', sans-serif;
    font-weight: 400;
    transition: all 0.3s ease;
}

/* Footer */
.footer {
    background: var(--bg-tertiary);
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-family: 'IRANYekan', sans-serif;
    font-weight: 400;
    transition: all 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 20px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: center;
    }
    
    .search-container {
        width: 100%;
        max-width: 400px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .nav-list {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 250px;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .video-card {
        margin: 0 10px;
    }
    
    .video-thumbnail {
        height: 150px;
    }
    
    .play-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Animation for loading */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card {
    animation: fadeIn 0.5s ease-out;
}

/* Category-specific colors */
.video-category[data-category="widgets"],
.video-card[data-category*="widgets"] .video-category:nth-child(1) {
    background: var(--accent-color);
}

.video-category[data-category="plugins"],
.video-card[data-category*="plugins"] .video-category:nth-child(2) {
    background: var(--accent-hover);
    color: white;
}

.video-category[data-category="basic"],
.video-card[data-category*="basic"] .video-category:nth-child(3) {
    background: var(--accent-light);
}

.video-category[data-category="advanced"],
.video-card[data-category*="advanced"] .video-category:nth-child(4) {
    background: var(--accent-dark);
    color: white;
}

.video-category[data-category="misc"],
.video-card[data-category*="misc"] .video-category:nth-child(5) {
    background: var(--accent-darker);
}

/* Multi-category styling */
.video-categories .video-category:nth-child(1) { background: #0093ff; }
.video-categories .video-category:nth-child(2) { background: #00b4ff; }
.video-categories .video-category:nth-child(3) { background: #0080ff; }
.video-categories .video-category:nth-child(4) { background: #0066cc; }
.video-categories .video-category:nth-child(5) { background: #0073e6; }

/* Video Modal Styles */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: var(--overlay-bg);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.video-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: var(--modal-bg);
    border-radius: 15px;
    width: 50%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow-hover);
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 25px;
    background: var(--accent-color);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    font-family: 'IRANYekan', sans-serif;
    transition: all 0.3s ease;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 0;
    background: #000;
}

.h_iframe-aparat_embed_frame {
    position: relative;
}

.h_iframe-aparat_embed_frame .ratio {
    display: block;
    width: 100%;
    height: auto;
}

.h_iframe-aparat_embed_frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 15px 15px;
}

/* Fallback image inside modal: same sizing as iframe, cover without scroll */
.h_iframe-aparat_embed_frame #videoFallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .close-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .h_iframe-aparat_embed_frame iframe {
        border-radius: 0;
    }
}
