/* ============================================
   Story Blog Website (قصص) — Main Stylesheet
   ============================================ */

/* ---- Root Variables ---- */
:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B83FF;
    --secondary: #FF6B6B;
    --accent: #4ECDC4;
    --dark: #1a1a2e;
    --darker: #16213e;
    --light: #f8f9fa;
    --text: #333;
    --text-muted: #6c757d;
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-hero: linear-gradient(135deg, #6C63FF 0%, #4ECDC4 50%, #FF6B6B 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Global ---- */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.8;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* ---- Navbar ---- */
.bg-primary-gradient {
    background: var(--gradient-primary) !important;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.navbar-brand {
    letter-spacing: -0.5px;
}

.navbar .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition);
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.navbar .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.navbar .form-control {
    border-radius: 8px 0 0 8px !important;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 0.5rem;
    animation: fadeInDown 0.25s ease;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--primary);
    color: #fff;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Hero Section ---- */
.hero-section {
    background: var(--gradient-hero);
    padding: 4rem 0;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 6s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    position: relative;
}

.hero-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
}

/* ---- Section Titles ---- */
.section-title {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary);
    display: inline-block;
}

.section-title i {
    color: var(--primary);
}

/* ---- Story Cards ---- */
.story-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 3px solid #28a745;
}

.story-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.story-card .read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    margin-top: 0.75rem;
    transition: var(--transition);
}

.story-card .read-more:hover {
    color: var(--secondary);
    gap: 10px;
}




.story-card .card-img-wrapper {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.story-card .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.story-card:hover .card-img-wrapper img {
    transform: scale(1.08);
}

.story-card .card-img-placeholder {
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 3rem;
}

.story-card .category-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary-dark);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
}

.story-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.story-card .card-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.story-card .card-title a {
    color: var(--dark);
}

.story-card .card-title a:hover {
    color: var(--primary);
}

.story-card .card-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    flex: 1;
}

.story-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    margin-top: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Category Cards ---- */
.category-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.category-card .cat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: #fff;
    font-size: 1.5rem;
}

.category-card h5 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.category-card .story-count {
    color: #495057;
    font-size: 0.85rem;
}

/* ---- Story Detail ---- */
.story-detail {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.story-detail .story-cover {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}

.story-detail .story-body {
    padding: 2rem;
}

.story-detail .story-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.story-detail .story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.story-detail .story-meta span i {
    color: var(--primary);
    margin-left: 4px;
}

.story-detail .story-content {
    font-size: 1.1rem;
    line-height: 2;
}

.story-detail .story-content p {
    margin-bottom: 1.25rem;
}

/* ---- Sidebar ---- */
.sidebar-widget {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-widget .widget-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.sidebar-widget .list-group-item {
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.6rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.sidebar-widget .list-group-item:hover {
    padding-right: 0.5rem;
    color: var(--primary);
}

.sidebar-widget .badge {
    background: var(--primary);
    font-weight: 500;
}

/* ---- Popular Story Mini Cards ---- */
.popular-story {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.popular-story:last-child {
    border-bottom: none;
}

.popular-story .ps-img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.popular-story .ps-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-story .ps-placeholder {
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.popular-story .ps-info h6 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.popular-story .ps-info h6 a {
    color: var(--dark);
}

.popular-story .ps-info h6 a:hover {
    color: var(--primary);
}

.popular-story .ps-info small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ---- Footer ---- */
.site-footer {
    background: var(--darker) !important;
}

.footer-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
}

.site-footer .text-muted {
    color: #ced4da !important;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #adb5bd;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-light);
    padding-right: 5px;
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-3px);
}

/* ---- Contact Form ---- */
.contact-form {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
}

.contact-form .form-control,
.contact-form .form-select {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    transition: var(--transition);
}

.contact-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(108, 99, 255, 0.15);
}

/* ---- Buttons ---- */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
    background: var(--primary-dark);
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ---- Pagination ---- */
.pagination .page-item .page-link {
    border: none;
    color: var(--text);
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin: 0 2px;
    border-radius: 8px !important;
    transition: var(--transition);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.3);
}

.pagination .page-item .page-link:hover {
    background: rgba(108, 99, 255, 0.1);
    color: var(--primary);
}

/* ---- Breadcrumb ---- */
.breadcrumb-section {
    background: #fff;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

/* ---- Search Results ---- */
.search-header {
    background: var(--gradient-primary);
    color: #fff;
    padding: 3rem 0;
    text-align: center;
    margin-bottom: 2rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---- Alerts ---- */
.alert {
    border-radius: var(--radius);
    border: none;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1rem;
    display: block;
}

.empty-state h4 {
    font-weight: 700;
    color: var(--text);
}

/* ---- Mobile Responsive ---- */
@media (max-width: 991.98px) {
    .hero-section {
        padding: 3rem 0;
    }

    .hero-section h1 {
        font-size: 1.8rem;
    }

    .story-detail .story-title {
        font-size: 1.5rem;
    }

    .story-detail .story-body {
        padding: 1.25rem;
    }

    .contact-form {
        padding: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .hero-section {
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    body {
        font-size: 15px;
    }

    .story-card .card-img-wrapper {
        height: 170px;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .story-detail .story-meta {
        gap: 0.75rem;
        font-size: 0.8rem;
    }
}

/* ---- Admin Styles ---- */
.admin-sidebar {
    background: var(--darker);
    min-height: 100vh;
    width: 260px;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1040;
    transition: var(--transition);
    overflow-y: auto;
}

.admin-sidebar.collapsed {
    transform: translateX(260px);
}

.admin-sidebar .sidebar-brand {
    padding: 1.25rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar .sidebar-brand h4 {
    color: #fff;
    font-weight: 700;
    margin: 0;
}

.admin-sidebar .sidebar-brand small {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    border-radius: 8px;
    margin: 2px 0.5rem;
    transition: var(--transition);
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(108, 99, 255, 0.2);
    color: #fff;
}

.admin-sidebar .nav-link i {
    width: 28px;
    text-align: center;
    margin-left: 0.5rem;
}

.admin-content {
    margin-right: 260px;
    min-height: 100vh;
    background: #f0f2f5;
    transition: var(--transition);
}

.admin-content.expanded {
    margin-right: 0;
}

.admin-topbar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.admin-topbar .toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

/* ---- Admin Stats Cards ---- */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-right: 4px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

/* ---- Admin Table ---- */
.admin-table {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.admin-table .table {
    margin-bottom: 0;
}

.admin-table .table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 1rem;
    border: none;
}

.admin-table .table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: rgba(0, 0, 0, 0.05);
}

.admin-table .table .btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* ---- Admin Forms ---- */
.admin-form {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.admin-form .form-label {
    font-weight: 600;
}

.admin-form .form-control,
.admin-form .form-select {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    border: 2px solid #e9ecef;
}

.admin-form .form-control:focus,
.admin-form .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(108, 99, 255, 0.1);
}

/* ---- Admin Mobile ---- */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(260px);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-content {
        margin-right: 0;
    }

    .admin-topbar {
        z-index: 1050;
    }

    .admin-topbar .toggle-sidebar {
        font-size: 1.6rem;
        padding: 0.4rem 0.75rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: #f0f2f5;
        position: relative;
        z-index: 1060;
    }

    .admin-topbar .toggle-sidebar:active {
        background: var(--primary);
        color: #fff;
    }

    .admin-table .table th,
    .admin-table .table td {
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    .admin-form {
        padding: 1.25rem;
    }
}

/* ---- Loading Spinner ---- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(108, 99, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Like Button ---- */
.btn-like {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 50px;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    background: transparent;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-like:hover,
.btn-like.liked {
    background: #e74c3c;
    color: #fff;
}

.btn-like.liked {
    animation: likePopIn 0.4s ease;
}

@keyframes likePopIn {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ---- Share Buttons ---- */
.btn-share {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-share:hover {
    transform: translateY(-3px);
    opacity: 0.85;
    color: #fff;
}

.btn-facebook {
    background: #1877f2;
}

.btn-twitter {
    background: #000;
}

.btn-whatsapp {
    background: #25d366;
}

.btn-telegram {
    background: #0088cc;
}

.btn-copy {
    background: #6c757d;
}

/* ---- Copy Toast ---- */
/* ---- Copy Toast ---- */
.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    z-index: 9999;
    pointer-events: none;
}

.copy-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ---- Comments Section ---- */
.comments-section {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-header strong {
    color: var(--primary);
}

.comment-body {
    color: #444;
    line-height: 1.8;
    margin: 0;
}

.comment-form-box {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1rem;
}

.comment-form-box .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(108, 99, 255, 0.15);
}