/* Tutorials Specific Styles */

/* Tutorial Content Formatting */
.tutorial-body {
    line-height: 1.7;
    font-size: 1.1rem;
    color: #333;
}

.tutorial-body p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

/* Fix raw markdown symbols */
.tutorial-body p:has-text("# "),
.tutorial-body p:has-text("## "),
.tutorial-body p:has-text("### ") {
    display: none;
}

/* Hide paragraphs that start with markdown headers */
.tutorial-body p:first-child:contains("#") {
    display: none;
}

/* Style for section headers that appear as paragraphs */
.tutorial-body p:contains("##") {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Fix malformed code blocks */
.tutorial-body p:contains("<code></code>") {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* Clean up code formatting */
.tutorial-body code {
    background: #f1f3f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    color: #d63384;
}

/* Pre-formatted code blocks */
.tutorial-body pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.tutorial-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

/* Lists styling */
.tutorial-body ul, .tutorial-body ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.tutorial-body li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Strong text styling */
.tutorial-body strong {
    font-weight: 600;
    color: #2c3e50;
}

/* Tutorial Hero Image Fix */
.hero-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    box-shadow: var(--box-shadow);
    position: static !important;
    z-index: auto !important;
}

/* Tutorial Container Layout */
.tutorial-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    position: relative;
    z-index: 1;
}

.tutorial-content {
    position: relative;
    z-index: 1;
}

.tutorial-header {
    position: relative;
    z-index: 1;
    margin-bottom: 2rem;
}

.tutorial-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.tutorial-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tutorial-meta span {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #6c757d;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.author-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.author-details {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.author-title {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

.table-of-contents {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.table-of-contents h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.table-of-contents ul {
    list-style: none;
    padding-left: 0;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
}

.table-of-contents a {
    color: #3498db;
    text-decoration: none;
    font-size: 0.95rem;
}

.table-of-contents a:hover {
    text-decoration: underline;
}

.table-of-contents ul ul {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

/* Hero Section */
.tutorials-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.tutorials-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-text h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
    opacity: 0.9;
    font-weight: 500;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    line-height: 1.6;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

.tutorials-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    gap: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    height: 100%;
    flex-wrap: wrap;
}

.tutorials-illustration i {
    animation: float 6s ease-in-out infinite;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorials-illustration i:nth-child(1) { animation-delay: 0s; }
.tutorials-illustration i:nth-child(2) { animation-delay: 1.5s; }
.tutorials-illustration i:nth-child(3) { animation-delay: 3s; }
.tutorials-illustration i:nth-child(4) { animation-delay: 4.5s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

/* Section Description */
.section-description {
    text-align: center;
    margin: 0 auto 2rem;
    max-width: 800px;
    font-size: 1.1rem;
    color: #555;
}

/* Tutorial List Section */
.tutorials-list {
    padding: 3rem 0;
}

/* Search and Filter Section */
.search-filter-section {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 3rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.search-container {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1.1rem;
}

#tutorial-search {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

#tutorial-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 180px;
}

.filter-group label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Roboto', sans-serif;
    background-color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Results Summary */
.results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
}

#results-count {
    font-weight: 500;
    color: #495057;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
}

.view-btn.active,
.view-btn:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.no-results-content i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #495057;
}

.no-results-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    background: white;
    color: #495057;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn:hover {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.pagination-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.pagination-ellipsis {
    padding: 0.75rem 0.5rem;
    color: #6c757d;
    display: flex;
    align-items: center;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Tutorial Grid */
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.tutorial-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.tutorial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card-img {
    height: 200px;
    position: relative;
    overflow: hidden;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.level-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.beginner {
    background-color: #4caf50;
}

.intermediate {
    background-color: #2196f3;
}

.advanced {
    background-color: #ff9800;
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.card-content h3 a {
    color: var(--dark-color);
    text-decoration: none;
}

.card-content h3 a:hover {
    color: var(--primary-color);
}

.meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #777;
}

.card-content p {
    margin-bottom: 1.5rem;
    color: #555;
    line-height: 1.5;
}

.read-more {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
}

.read-more i {
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

.read-more:hover i {
    transform: translateX(3px);
}

/* More Coming Soon */
.more-coming-soon {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
}

.placeholder-content {
    text-align: center;
    padding: 2rem;
}

.placeholder-content i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite alternate;
}

@keyframes float {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-10px);
    }
}

.placeholder-content h3 {
    margin-bottom: 0.75rem;
}

.placeholder-content p {
    color: #666;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.5rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
}

.pagination a {
    background-color: white;
    color: var(--dark-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.pagination a:hover:not(.disabled) {
    background-color: var(--primary-color);
    color: white;
}

.pagination .current {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

.pagination .disabled {
    background-color: #f0f0f0;
    color: #aaa;
    cursor: not-allowed;
}

/* Tutorial Card Styles */
.tutorial-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.tutorial-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tutorial-card:hover .tutorial-image img {
    transform: scale(1.1);
}

.tutorial-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.tutorial-badge.beginner {
    background: #4CAF50;
}

.tutorial-badge.intermediate {
    background: #2196F3;
}

.tutorial-badge.advanced {
    background: #FF9800;
}

.tutorial-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tutorial-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    line-height: 1.3;
}

.tutorial-content h3 a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.tutorial-content h3 a:hover {
    color: #667eea;
}

.tutorial-content p {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.tutorial-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #6c757d;
    flex-wrap: wrap;
}

.tutorial-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.tutorial-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.tutorial-category {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 500;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
}

/* List View Styles */
.tutorial-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tutorial-card.list-view {
    flex-direction: row;
    max-height: 200px;
}

.tutorial-card.list-view .tutorial-image {
    width: 300px;
    height: 200px;
    flex-shrink: 0;
}

.tutorial-card.list-view .tutorial-content {
    padding: 1.5rem 2rem;
}

.tutorial-card.list-view .tutorial-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.tutorial-card.list-view .tutorial-content p {
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Newsletter Section */
.newsletter-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.newsletter-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.newsletter-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.newsletter-form input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
}

.newsletter-form button {
    padding: 1rem 2rem;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.newsletter-form button:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

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

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Ad Container Styles */
.ad-container {
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-ad {
    margin: 1rem 0;
}

.content-ad {
    margin: 3rem 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .tutorials-illustration {
        justify-content: center;
        gap: 1rem;
    }
    
    .tutorials-illustration i {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .search-filter-section {
        padding: 1.5rem;
    }
    
    .filters-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .results-summary {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .tutorial-grid {
        grid-template-columns: 1fr;
    }
    
    .tutorial-card.list-view {
        flex-direction: column;
        max-height: none;
    }
    
    .tutorial-card.list-view .tutorial-image {
        width: 100%;
        height: 200px;
    }
    
    .newsletter-form {
        flex-direction: column;
        max-width: 300px;
    }
    
    .newsletter-content h2 {
        font-size: 2rem;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .search-filter-section {
        padding: 1rem;
    }
    
    .tutorial-card {
        margin: 0 0.5rem;
    }
    
    .newsletter-content h2 {
        font-size: 1.8rem;
    }
}
