/* =========================================
   app/static/css/style.css
   Main Stylesheet for AI Software Portfolio
   (Cleaned & Consolidated)
========================================= */

/* === 1. CSS VARIABLES (Color Palette) === */
:root {
    --primary-color: #030303; /* Dark Black */
    --accent-color: #E74C3C;  /* Red */
    --bg-color: #e6e6e6;      /* Light Gray Background */
    --text-dark: #212529;
    --text-light: #f8f9fa;
    231, 76, 60
}

/* === 2. BASE & TYPOGRAPHY === */
body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* === 3. HEADER, NAVBAR & FOOTER === */
.custom-navbar {
    background-color: var(--primary-color);
    padding: 1rem 0;
    border-bottom: 3px solid var(--accent-color);
}

.custom-navbar .navbar-brand {
    color: var(--text-light) !important;
    transition: opacity 0.3s;
}

.custom-navbar .navbar-brand:hover { opacity: 0.8; }

.custom-navbar .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin-left: 5px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.custom-navbar .nav-link:hover, 
.custom-navbar .nav-link:focus,
.custom-navbar .nav-link.active {
    color: var(--primary-color) !important;
    background-color: var(--accent-color);
}

.custom-footer {
    background-color: var(--primary-color);
    color: rgba(255, 255, 255, 0.7);
    margin-top: auto;
    border-top: 1px solid rgba(26, 208, 254, 0.2);
}

.custom-footer a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
    font-weight: 500;
}

.custom-footer a:hover { color: var(--accent-color); }

.social-icon {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
}
.social-icon:hover { color: var(--accent-color); }

/* === 4. SHARED UI COMPONENTS (Buttons, Cards, Badges) === */
.btn-accent {
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-weight: 700;
    border: none;
    transition: all 0.3s ease;
}
.btn-accent:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-unified {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}
.btn-unified:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-outline-unified {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    font-weight: 700;
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}
.btn-outline-unified:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.clean-card {
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}
a.clean-card:hover, div.clean-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.card-img-custom, .empty-img-placeholder {
    height: 200px;
    object-fit: cover;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
.empty-img-placeholder {
    background-color: #f8f9fa;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.unified-badge {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid rgba(27, 65, 88, 0.2);
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}
.unified-badge:hover {
    background-color: var(--primary-color);
    color: white;
}

.item-tag {
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    display: inline-block;
}

.breadcrumb-custom a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}
.breadcrumb-custom a:hover { text-decoration: underline; }

/* === 5. ARTICLES & CONTENT VIEWER (Blog, Project, Lesson) === */
.portfolio-header, .lesson-header, .blog-header, .section-header {
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    margin-bottom: 1.5rem;
}

.article-container {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
}
.hero-img {
    max-height: 450px;
    width: 100%;
    object-fit: cover;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.meta-tag {
    border: 1px solid rgba(0,0,0,0.1);
    color: #6c757d;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.unified-content {
    font-size: 1.15rem;
    line-height: 2;
    color: #2b3035;
    text-align: justify;
}
.unified-content h2, .unified-content h3, .unified-content h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}
.unified-content ul, .unified-content ol { margin-bottom: 1.5rem; padding-right: 2rem; }
.unified-content li { margin-bottom: 0.5rem; }
.unified-content blockquote {
    border-right: 4px solid var(--accent-color);
    padding-right: 15px;
    color: #6c757d;
    font-style: italic;
    background-color: #f8f9fa;
    padding: 1rem 1.5rem 1rem 0;
    border-radius: 4px;
    margin: 1.5rem 0;
}
.unified-content pre {
    background-color: #1a1d20;
    color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    direction: ltr;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.unified-content code {
    color: #d63384;
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(0,0,0,0.03);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}
.unified-content pre code { color: inherit; background-color: transparent; padding: 0; }
.unified-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 1.5rem 0; border: 1px solid rgba(0,0,0,0.05); }

/* Project Specific */
.feature-list { list-style: none; padding-right: 0; }
.feature-list li { padding: 0.8rem 0; border-bottom: 1px dashed rgba(0,0,0,0.05); display: flex; align-items: flex-start; gap: 0.5rem; }
.feature-list li::before { content: '•'; color: var(--accent-color); font-weight: bold; font-size: 1.5rem; line-height: 1; }
.action-btn { font-weight: 700; padding: 0.8rem 2rem; border-radius: 50px; transition: all 0.3s ease; text-decoration: none; }
.btn-demo { background-color: var(--primary-color); color: white; border: none; }
.btn-demo:hover { background-color: var(--accent-color); color: var(--primary-color); transform: translateY(-2px); }
.btn-github { background-color: #24292e; color: white; border: none; }
.btn-github:hover { background-color: #000; color: white; transform: translateY(-2px); }

/* Lessons Specific */
.prerequisites-wrapper {
    background: #f8f9fa;
    border: 1px solid rgba(27, 65, 88, 0.05);
    border-right: 4px solid var(--accent-color);
    border-radius: 12px;
    padding: 1.8rem;
    margin-bottom: 2.5rem;
}
.prerequisites-header { display: flex; align-items: center; gap: 12px; margin-bottom: 1.2rem; }
.prereq-icon { color: var(--accent-color); }
.prerequisites-title { font-weight: 800; color: var(--primary-color); margin: 0; font-size: 1.25rem; }
.prerequisites-list { list-style: none; padding: 0; margin: 0; }
.prerequisites-list li {
    position: relative;
    padding-right: 2.2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    font-size: 1.05rem;
    font-weight: 500;
}
.prerequisites-list li::before {
    content: "✓";
    position: absolute;
    right: 0;
    top: 2px;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1rem;
    background-color: var(--bg-color);
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* === 6. ADMIN DASHBOARD (Forms, Tables, Headers) === */
.admin-page-title {
    color: var(--primary-color);
    font-weight: 800;
    border-bottom: 2px solid rgba(27, 65, 88, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}
.card-header-custom {
    background-color: var(--primary-color);
    color: white;
    padding: 1.2rem 1.5rem;
    font-weight: 700;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-label { color: var(--primary-color); font-weight: 700; }
.form-control, .form-select {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    transition: all 0.3s;
    background-color: #f8f9fa;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(26, 208, 254, 0.25);
    background-color: #ffffff;
}

.table-custom { margin-bottom: 0; }
.table-custom th {
    background-color: rgba(0,0,0,0.02);
    color: var(--primary-color);
    font-weight: 700;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding: 1rem;
}
.table-custom td {
    vertical-align: middle;
    padding: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    color: var(--text-dark);
    font-weight: 500;
}

.btn-action {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    color: var(--text-dark);
    background: #fff;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-action:hover { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.btn-action-danger { color: #dc3545; }
.btn-action-danger:hover { background: #dc3545; color: #fff; border-color: #dc3545; }
.badge-unified { background-color: rgba(26, 208, 254, 0.15); color: var(--primary-color); font-weight: 700; padding: 0.4rem 0.8rem; border-radius: 6px; }

/* === 7. COMMENTS SYSTEM === */
.comments-section-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(27, 65, 88, 0.1);
}
.comment-box {
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.custom-textarea {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 120px;
}
.custom-textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(26, 208, 254, 0.25);
    outline: none;
}
.comment-bubble {
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.admin-bubble {
    background-color: rgba(26, 208, 254, 0.05);
    border: 1px solid rgba(27, 65, 88, 0.1);
}
.admin-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
}
.logout-link { color: #dc3545; font-weight: 600; text-decoration: none; font-size: 0.9rem; transition: opacity 0.3s; }
.logout-link:hover { opacity: 0.7; }

/* === 8. STATIC & ERROR PAGES (Contact, Terms, 404, 500) === */
.page-wrapper, .error-container {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.03);
    padding: 2.5rem 2rem;
}
.error-container { padding: 4rem 1rem; margin-top: 2rem; margin-bottom: 3rem; text-align: center; }

.page-title { color: var(--primary-color); font-weight: 800; font-size: 2.5rem; }
.error-code {
    font-size: clamp(6rem, 15vw, 10rem);
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    text-shadow: 5px 5px 0px rgba(26, 208, 254, 0.2);
    margin-bottom: 1.5rem;
}
.error-title { color: var(--text-dark); font-weight: 700; margin-bottom: 1.5rem; }

.section-heading {
    color: var(--primary-color);
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
    display: flex; align-items: center; gap: 10px;
}
.content-text, .intro-text { line-height: 1.9; color: #4a5568; font-size: 1.15rem; }
.intro-text { font-size: 1.25rem; }

/* Contact Cards Specific */
.contact-card { padding: 2.5rem 2rem; border-radius: 12px; height: 100%; transition: transform 0.3s ease; }
.contact-card:hover { transform: translateY(-5px); }
.contact-card.social-card { background-color: rgba(26, 208, 254, 0.05); border: 1px solid rgba(26, 208, 254, 0.2); }
.contact-card.business-card { background-color: rgba(27, 65, 88, 0.03); border: 1px solid rgba(27, 65, 88, 0.1); }
.contact-btn {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
}
.contact-btn:hover { background: var(--primary-color); color: white; box-shadow: 0 5px 15px rgba(27, 65, 88, 0.15); }
.contact-icon { font-size: 1.3rem; }

/* === 9. RESPONSIVE & MOBILE QUERIES === */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: rgba(0, 0, 0, 0.15);
        padding: 1.5rem;
        border-radius: 8px;
        margin-top: 1rem;
    }
    .custom-navbar .nav-link { margin-bottom: 0.5rem; margin-left: 0; text-align: right; }
    .mobile-divider { border-top: 1px solid rgba(255, 255, 255, 0.1) !important; border-left: none !important; padding-top: 1rem; margin-top: 1rem; justify-content: center; }
    .admin-btn-wrapper { width: 100%; margin-top: 1rem; }
    .admin-btn-wrapper .btn { width: 100%; padding: 0.8rem; }
    .footer-links { flex-direction: column; gap: 1rem !important; margin-bottom: 2rem !important; }
}

/* === 10. PAGE: HOME (main.html) === */

.row.g-4 > div {
    display: flex;
}
.row.g-4 .clean-card {
    width: 100%;
    display: flex;
    flex-direction: column;
}
.row.g-4 .clean-card .card-body {
    flex-grow: 1; /* يدفع الفوتر (مثل زر القراءة) للأسفل دائماً */
    display: flex;
    flex-direction: column;
}
.row.g-4 .clean-card .card-footer,
.row.g-4 .clean-card .mt-auto {
    margin-top: auto !important; 
}

/* تحسين شكل تأثير المرور على زر "الكل" */
.btn-outline-dark:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}