/* ============================================
   pishgamit - COMPONENT STYLES
   Modern Persian Tech News Portal
   ============================================ */

/* ============================================
   ARTICLE CARDS
   ============================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

/* Card Default (Vertical) */
.card-default {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-image {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    background: var(--bg-tertiary);
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
    backdrop-filter: blur(8px);
}

.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease-out;
}

.card:hover .card-title a {
    color: var(--accent-primary);
}

.card-excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.card-meta-item a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease-out;
}

.card-meta-item a:hover {
    color: var(--accent-primary);
}

.card-meta i {
    font-size: 0.875rem;
}

/* Card Horizontal */
.card-horizontal {
    display: flex;
    flex-direction: row;
}

.card-horizontal .card-image {
    width: 120px;
    min-width: 120px;
    padding-top: 0;
    height: 100%;
}

.card-horizontal .card-image img {
    position: relative;
}

.card-horizontal .card-body {
    padding: 0.875rem;
}

.card-horizontal .card-title {
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.card-horizontal .card-excerpt {
    display: none;
}

.card-horizontal .card-meta {
    font-size: 0.75rem;
    padding-top: 0.5rem;
    margin-top: auto;
}

/* Card Featured */
.card-featured {
    position: relative;
    min-height: 400px;
}

.card-featured .card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding-top: 0;
}

.card-featured::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    z-index: 1;
}

.card-featured .card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    color: #fff;
    padding: 2rem;
}

.card-featured .card-title {
    font-size: 1.2rem;
    color: #fff;
    padding-top: 1rem;
}

.card-featured .card-title a {
    color: #fff;
}

.card-featured .card-excerpt {
    color: rgba(255, 255, 255, 0.9);
}

.card-featured .card-meta {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

/* Card Minimal */
.card-minimal {
    padding: 1.25rem;
}

.card-minimal .card-image {
    display: none;
}

.card-minimal .card-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.hero-main {
    position: relative;
    min-height: 500px;
    border-radius: 16px;
    overflow: hidden;
}

.hero-side {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-side-item {
    position: relative;
    min-height: 158px;
    border-radius: 12px;
    overflow: hidden;
}

@media (max-width: 991px) {
    .hero-section {
        grid-template-columns: 1fr;
    }

    .hero-side {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .hero-side {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   CATEGORY SECTION
   ============================================ */

.category-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title .icon {
    font-size: 1.5rem;
}

.section-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.view-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: gap 0.2s ease-out;
}

.view-all:hover {
    gap: 0.75rem;
}

.section-content {
    position: relative;
}

.horizontal-scroll {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.horizontal-scroll .card {
    min-width: 300px;
    scroll-snap-align: start;
}

.scroll-indicators {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.scroll-prev,
.scroll-next {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-prev:hover,
.scroll-next:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

/* ============================================
   SIDEBAR WIDGETS
   ============================================ */

.sidebar {
    position: sticky;
    top: 100px;
}

.widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.widget-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.widget-tabs {
    display: flex;
    gap: 0.5rem;
}

.widget-tabs button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.widget-tabs button.active,
.widget-tabs button:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* Search Widget */
.search-input-wrapper {
    position: relative;
    display: flex;
    gap: 0.5rem;
}

.search-input-wrapper input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s ease-out;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input-wrapper button {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: var(--accent-primary);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.search-input-wrapper button:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
}

/* Popular Posts Widget */
.popular-post-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.popular-post-item:last-child {
    border-bottom: none;
}

.popular-post-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
}

.popular-post-content h6 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.popular-post-content a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease-out;
}

.popular-post-content a:hover {
    color: var(--accent-primary);
}

.popular-post-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
}

.popular-post-meta a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease-out;
}

.popular-post-meta a:hover {
    color: var(--accent-primary);
}

/* Tags Cloud Widget */
.widget h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget h3 i {
    color: var(--accent-primary);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-cloud a,
.tag-cloud .tag-item {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease-out;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.tag-cloud a::before,
.tag-cloud .tag-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
    z-index: -1;
}

.tag-cloud a:hover,
.tag-cloud .tag-item:hover {
    color: #fff;
}

.tag-cloud a:hover::before,
.tag-cloud .tag-item:hover::before {
    width: 100%;
}

/* Active state for currently selected tag */
.tag-cloud a.active,
.tag-cloud .tag-item.active {
    background: var(--accent-primary);
    color: #fff;
}

.tag-cloud a.active::before,
.tag-cloud .tag-item.active::before {
    width: 100%;
}

/* Newsletter Widget */
.newsletter-widget {
    text-align: center;
}

.newsletter-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.newsletter-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.newsletter-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.newsletter-form input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.newsletter-form button {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.newsletter-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Widget Footer */
.widget-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.widget-footer .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}


/* ============================================
   TELEGRAM CTA SECTION
   ============================================ */

.telegram-cta {
    position: relative;
    padding: 4rem 2rem;
    border-radius: 20px;
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    overflow: hidden;
    margin: 3rem 0;
    text-align: center;
    color: #fff;
}

.telegram-cta::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.telegram-cta::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 8s ease-in-out infinite;
}

.telegram-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.telegram-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.telegram-description {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

.telegram-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: #fff;
    color: #0088cc;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.telegram-button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 3rem 0;
    list-style: none;
    padding: 0;
}

.pagination .page-item {
    display: inline-block;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    padding: 0 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease-out;
    font-weight: 500;
    font-size: 1rem;
}

.pagination .page-link:hover:not(.disabled) {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.25);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    padding: 0 1.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 991px) {
    .sidebar {
        position: static;
        margin-top: 3rem;
    }
}

@media (max-width: 767px) {
    .card-title {
        font-size: 1rem;
    }

    .section-title h2 {
        font-size: 1.5rem;
    }

    .telegram-title {
        font-size: 1.5rem;
    }

    .telegram-description {
        font-size: 1rem;
    }
}

/* ============================================
   POST CARDS (User-Generated Content)
   Distinct styling from news cards
   ============================================ */

.post-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.post-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
}

.post-card .card-img-top {
    height: 200px;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .card-img-top {
    transform: scale(1.08);
}

.post-card-placeholder {
    height: 200px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(34, 197, 94, 0.3);
    transition: all 0.3s ease;
}

.post-card:hover .post-card-placeholder {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.08) 100%);
    color: rgba(34, 197, 94, 0.5);
}

.post-card .card-body {
    padding: 1.5rem;
}

.post-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-card-header .badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
    font-weight: 600;
    border-radius: 6px;
}

.post-card-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.125rem;
    line-height: 1.5;
    transition: color 0.2s ease-out;
    display: block;
}

.post-card:hover .post-card-title {
    color: #22c55e;
}

.post-card .card-excerpt {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-author {
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: color 0.2s ease-out;
}

.post-author:hover {
    color: #22c55e;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.post-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.post-meta-item i {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Responsive adjustments for post cards */
@media (max-width: 767px) {
    .post-card .card-img-top,
    .post-card-placeholder {
        height: 180px;
    }

    .post-card-title {
        font-size: 1rem;
    }

    .post-card .card-body {
        padding: 1.25rem;
    }
}