/* style.css */

/* --- KRG Color Variables --- */
:root {
    --krg-green: #008000;
    --krg-red: #DA291C;
    --krg-yellow: #FEBD11;
    --krg-white: #FFFFFF;
    --krg-dark: #2c3e50;
    --krg-light-bg: #f7f9fa;
    --krg-border: #e0e0e0;
}

/* --- Base Styles --- */
body { 
    font-family: 'Noto Sans Arabic', Tahoma, sans-serif; 
    background-color: var(--krg-light-bg); 
    margin: 0; 
    padding-top: 80px; 
}
a { 
    text-decoration: none; 
}

/* --- 1. Header & Navigation (Fixed Top Bar) --- */
.top-header { 
    position: fixed; top: 0; right: 0; left: 0; background-color: var(--krg-dark); 
    padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; 
    z-index: 1000; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); 
}
.header-left, .header-right {
    display: flex;
    align-items: center;
}
.header-logo { 
    height: 40px; 
    margin: 0 15px; 
}
.logo-title { 
    font-size: 1.6em; 
    font-weight: 700; 
    color: var(--krg-yellow); 
}
.user-actions { 
    font-size: 0.9em; 
}
.search-form { 
    display: flex; 
    flex-grow: 1; 
    justify-content: center; 
    margin: 0 20px; 
}
.search-input { 
    padding: 8px 15px; 
    border-radius: 20px; 
    border: 1px solid #555; 
    width: 350px; 
    text-align: right; 
    background-color: #fcfcfc; 
    color: var(--krg-dark); 
}
.search-button { 
    background: var(--krg-red); 
    color: var(--krg-white); 
    border: none; 
    padding: 8px 15px; 
    border-radius: 20px; 
    margin-right: 10px; 
    cursor: pointer;
    transition: background-color 0.2s;
}
.search-button:hover { 
    background-color: #c92418; 
}


/* --- 2. Main Layout --- */
.main-container { 
    display: flex; 
    max-width: 1500px; 
    margin: 20px auto; 
    padding: 0 30px; 
}

/* --- 3. Department Filter Sidebar --- */
.sidebar { 
    width: 250px; padding: 20px; background: var(--krg-white); 
    border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); 
    height: fit-content; margin-top: 10px;
}
.sidebar h3 { 
    color: var(--krg-dark); 
    border-bottom: 3px solid var(--krg-yellow); 
    padding-bottom: 10px; 
    margin-top: 0; 
    font-weight: 700; 
    font-size: 1.1em; 
}
.sidebar hr { 
    border: 0; 
    border-top: 1px solid var(--krg-border); 
    margin: 20px 0; 
}
.sidebar ul { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
}
.sidebar li a { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 12px 10px; 
    margin-bottom: 5px; 
    color: var(--krg-dark); 
    border-radius: 6px; 
    font-weight: 400;
}
.sidebar li a:hover { 
    background-color: #f0f0f0; 
}
.sidebar li a.active { 
    background-color: var(--krg-green); 
    color: var(--krg-white); 
    font-weight: 700; 
    box-shadow: 0 2px 4px rgba(0, 128, 0, 0.4);
}
.sidebar li a.all-posts { 
    background-color: var(--krg-red); 
    color: var(--krg-white); 
}
.post-count { 
    font-size: 0.9em; 
    opacity: 0.7; 
    padding: 2px 6px; 
    border-radius: 4px; 
    background-color: rgba(255, 255, 255, 0.2); 
}

/* --- 4. Post Feed Area --- */
.feed { 
    flex-grow: 1; 
    margin-right: 30px; 
} 
.posts-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); 
    gap: 30px; 
} 
.feed-header { 
    grid-column: 1 / -1; 
    color: var(--krg-dark); 
    border-bottom: 3px solid var(--krg-green); 
    padding-bottom: 10px; 
    margin-bottom: 20px; 
    font-weight: 700; 
    font-size: 1.8em; 
}

/* --- 5. Top 10 Posts Carousel (Stories Style) --- */
.stories-container {
    overflow-x: scroll; 
    overflow-y: hidden;
    white-space: nowrap; 
    padding: 10px 0;
    margin-bottom: 25px;
    -webkit-overflow-scrolling: touch; 
    border-bottom: 2px solid var(--krg-border);
    border-top: 2px solid var(--krg-border);
    background-color: var(--krg-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.stories-container::-webkit-scrollbar { display: none; }
.stories-container { -ms-overflow-style: none; scrollbar-width: none; }

.story-item {
    display: inline-block;
    width: 120px;
    text-align: center;
    margin-left: 20px;
    padding: 5px 0;
}

.story-thumb-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%; 
    overflow: hidden;
    margin: 0 auto 5px auto;
    border: 4px solid var(--krg-yellow); 
    padding: 2px;
    background-color: var(--krg-white);
    transition: border-color 0.3s, transform 0.2s;
}

.story-item:hover .story-thumb-wrapper {
    border-color: var(--krg-green);
    transform: scale(1.05);
}

.story-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.story-title {
    display: block;
    font-size: 0.8em;
    color: var(--krg-dark);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
    padding: 0 5px;
}

/* --- 6. Post Card Design (Advanced) --- */
.post-card { 
    background: var(--krg-white); border: 1px solid var(--krg-border); 
    border-radius: 12px; box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08); 
    overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; 
}
.post-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15); 
}
.post-card-content { 
    padding: 20px; 
}
.post-image { 
    width: 100%; 
    height: 200px; 
    object-fit: cover; 
}
.department-badge { 
    display: inline-block; 
    padding: 5px 12px; 
    border-radius: 6px; 
    background-color: var(--krg-green); 
    color: var(--krg-white); 
    font-size: 0.8em; 
    font-weight: 700; 
    margin-bottom: 10px;
}
.typepost-badge {
    display: inline-block; 
    padding: 5px 12px; 
    border-radius: 6px; 
    background-color: var(--krg-yellow); 
    color: var(--krg-dark); 
    font-size: 0.8em; 
    font-weight: 700; 
    margin-right: 8px;
}
.post-card h3 { 
    color: var(--krg-dark); 
    margin: 5px 0 10px; 
    font-size: 1.3em; 
    line-height: 1.4; 
}

/* --- Author Display & Footer Styles --- */
.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: #777;
    margin-top: 10px; 
    padding-top: 10px;
    border-top: 1px solid var(--krg-border);
}

.author-details {
    display: flex;
    align-items: center;
}

.author-icon {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: var(--krg-yellow); 
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: var(--krg-dark);
    margin-left: 8px; 
    font-size: 0.9em;
}

.date-posted {
    font-weight: 400;
    color: #999;
}

.view-button { 
    background-color: var(--krg-red); 
    color: var(--krg-white); 
    padding: 10px 20px; 
    border-radius: 6px; 
    font-weight: 700; 
    display: block; 
    text-align: center; 
    margin-top: 15px;
}
.view-button:hover { 
    background-color: #c92418; 
}

/* Loader Styles */
.loader-container {
    grid-column: 1 / -1; 
    text-align: center; 
    padding: 30px;
}

/* --- Floating Action Button (FAB) for Post Creation --- */
.fab {
    position: fixed; 
    bottom: 30px; 
    left: 30px; 
    background-color: var(--krg-yellow); 
    color: var(--krg-dark);
    padding: 15px 25px; 
    border-radius: 50px; 
    font-size: 1em; 
    font-weight: 700; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s; 
    z-index: 900;
}
.fab:hover { 
    background-color: #ffd740; 
}

/* --- Footer --- */
.footer { 
    background-color: var(--krg-dark); 
    color: var(--krg-white); 
    padding: 30px; 
    margin-top: 40px; 
    text-align: center; 
}
.footer-logo { 
    color: var(--krg-yellow); 
    font-size: 1.2em; 
    font-weight: 700; 
}

/* --- 7. Mobile Responsiveness --- */
@media (max-width: 900px) {
    /* Layout Stacking */
    body { padding-top: 100px; }
    .main-container { flex-direction: column; padding: 0 15px; }
    .posts-grid { grid-template-columns: 1fr; gap: 20px; } 
    .sidebar { width: 100%; margin-bottom: 20px; order: -1; box-shadow: none; border-radius: 0; padding: 15px; }
    
    /* Header adjustments */
    .top-header { flex-wrap: wrap; padding: 10px 15px; height: auto; }
    .logo-title { width: 100%; font-size: 1.4em; text-align: center; margin-bottom: 10px; }
    .search-form { width: 100%; margin: 0; order: 1; }
    .search-input { width: 80%; }
    .search-button { width: 15%; margin-right: 0; }
    .user-actions { display: none; } 

    /* Logo adjustments for mobile */
    .header-left, .header-right { width: 100%; justify-content: center; margin-bottom: 10px; }
    .header-left { order: -2; } 
    .logo-title { order: -1; } 
    .header-right { order: 2; margin-top: 10px; } 

    /* Carousel adjustments for mobile */
    .stories-container {
        margin: 0 -15px 25px -15px; 
        padding: 10px 15px;
    }
    .story-item { margin-left: 15px; }
    
    /* Center FAB on mobile */
    .fab {
        bottom: 20px; 
        left: 50%;
        transform: translateX(-50%); 
        padding: 12px 20px;
        font-size: 0.9em;
    }
}
/* New/Modified CSS for Developer Credit Box */

.developer-credit-box {
    /* Background and Padding to make it stand out */
    background-color: #3e4a59; /* Darker, professional background */
    color: #f7f7f7;             /* Light text */
    padding: 10px 20px;
    margin-top: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    
    /* Layout using Flexbox */
    display: flex;
    justify-content: center; /* Center the elements horizontally */
    align-items: center;
    gap: 20px; /* Space between the items */
    font-size: 0.9em;
}

.developer-credit-box a {
    color: var(--krg-yellow); /* Use the accent yellow for the link */
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s;
}

.developer-credit-box a:hover {
    color: var(--krg-white); /* White on hover for contrast */
}

.dev-tag i {
    color: var(--krg-red); /* Highlight the code icon */
    margin-left: 5px;
}

.dev-whatsapp {
    color: #25D366; /* WhatsApp official color for the text */
    font-weight: 600;
}

.dev-whatsapp i {
    color: #25D366; /* WhatsApp icon color */
    margin-left: 5px;
}