/**
 * Footer Widgets & Layout Stylesheet
 * Ahdath Alyom / SlashNews
 * Enqueued strictly when footer widgets are rendered.
 */

/* =========================================================
 * 1. Footer Box Container & Color Schemes
 * ========================================================= */
.footer-box {
    width: 100%;
    margin-top: 35px;
    padding: 50px 0 40px;
    border-top: 3px solid var(--main-color, #07467c);
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light Mode (وضع النهار) */
body:not(.dark) .footer-box {
    background: #f8fafc;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}

body:not(.dark) .footer-box .widget-title h2,
body:not(.dark) .footer-box .widget-title h3,
body:not(.dark) .footer-box .footer-heading {
    color: #07467c;
}

body:not(.dark) .footer-box a {
    color: #334155;
}

body:not(.dark) .footer-box a:hover {
    color: var(--main-color, #07467c);
}

body:not(.dark) .footer-box .sw-footer-text,
body:not(.dark) .footer-box .widget-content {
    color: #475569;
}

/* Dark Mode (الوضع الليلي) */
body.dark .footer-box {
    background: #0d131f;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark .footer-box .widget-title h2,
body.dark .footer-box .widget-title h3,
body.dark .footer-box .footer-heading {
    color: #ffffff;
}

body.dark .footer-box a {
    color: #cbd5e1;
}

body.dark .footer-box a:hover {
    color: #38bdf8;
}

body.dark .footer-box .sw-footer-text,
body.dark .footer-box .widget-content {
    color: #94a3b8;
}

/* Connect cleanly with the sub-footer <footer> */
.footer-box + footer,
.footer-box + .footer-copyright,
body .footer-box ~ footer {
    margin-top: 0 !important;
    border-top: none !important;
}

body:not(.dark) footer {
    background: #eef2f6 !important;
    color: #475569 !important;
}

body.dark footer {
    background: #080c14 !important;
    color: #94a3b8 !important;
}

/* =========================================================
 * 2. Multi-Column Grid Layout (توزيع الودجات 1-4 أعمدة)
 * ========================================================= */
.footer-box .container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Grid for footer columns */
.footer-widget-grid {
    display: grid;
    gap: 35px 30px;
    width: 100%;
    align-items: start;
    box-sizing: border-box;
}

/* When 4 separate sidebars are active */
.footer-widget-grid.footer-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* When 3 separate sidebars are active */
.footer-widget-grid.footer-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* When 2 separate sidebars are active */
.footer-widget-grid.footer-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* Single sidebar with multiple widgets inside (solves vertical stacking) */
.footer-widget-grid.footer-single-sidebar-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (min-width: 992px) {
    .footer-widget-grid.footer-single-sidebar-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

/* Override any default Bootstrap or SlashNews col classes inside footer */
.footer-box .footer-column,
.footer-box .widget,
.footer-box aside.widget {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    flex: 1 1 auto;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.footer-box .widget-inner {
    margin: 0 !important;
    padding: 0 !important;
}

.footer-box .widget-area {
    margin: 0 !important;
    padding: 0 !important;
}

/* =========================================================
 * 3. Footer Alignment (محاذاة الفوتر: وسط / يمين / يسار)
 * ========================================================= */

/* Right Alignment (اليمين - افتراضي RTL) */
.footer-box.footer-align-right,
.footer-box:not(.footer-align-center):not(.footer-align-left) {
    text-align: right;
}

.footer-box.footer-align-right .footer-widget-grid {
    justify-content: flex-start;
}

.footer-box.footer-align-right .widget-title h2::after,
.footer-box.footer-align-right .widget-title h3::after,
.footer-box.footer-align-right .footer-heading::after {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
}

.footer-box.footer-align-right .sw-footer-about {
    align-items: flex-start;
    text-align: right;
}

.footer-box.footer-align-right .sw-footer-about .sw-footer-logo {
    align-self: flex-start;
}

.footer-box.footer-align-right .sw-footer-social,
.footer-box.footer-align-right .social-links ul {
    justify-content: flex-start;
}

.footer-box.footer-align-right .sw-terms-widget.sw-terms-style-pills .sw-terms-list {
    justify-content: flex-start;
}

/* Center Alignment (في الوسط) */
.footer-box.footer-align-center {
    text-align: center;
}

.footer-box.footer-align-center .footer-widget-grid {
    justify-content: center;
}

.footer-box.footer-align-center .widget-header,
.footer-box.footer-align-center .widget-title {
    text-align: center;
}

.footer-box.footer-align-center .widget-title h2,
.footer-box.footer-align-center .widget-title h3,
.footer-box.footer-align-center .footer-heading {
    text-align: center;
}

.footer-box.footer-align-center .widget-title h2::after,
.footer-box.footer-align-center .widget-title h3::after,
.footer-box.footer-align-center .footer-heading::after {
    right: 50% !important;
    left: auto !important;
    transform: translateX(50%) !important;
}

.footer-box.footer-align-center .sw-footer-about {
    align-items: center;
    text-align: center;
}

.footer-box.footer-align-center .sw-footer-about .sw-footer-logo {
    align-self: center;
}

.footer-box.footer-align-center .sw-footer-social,
.footer-box.footer-align-center .social-links ul {
    justify-content: center;
}

.footer-box.footer-align-center .sw-terms-widget.sw-terms-style-pills .sw-terms-list {
    justify-content: center;
}

.footer-box.footer-align-center .sw-footer-links-list {
    align-items: center;
}

.footer-box.footer-align-center .sw-footer-post {
    justify-content: center;
}

/* Left Alignment (يسار) */
.footer-box.footer-align-left {
    text-align: left;
}

.footer-box.footer-align-left .footer-widget-grid {
    justify-content: flex-end;
}

.footer-box.footer-align-left .widget-title h2::after,
.footer-box.footer-align-left .widget-title h3::after,
.footer-box.footer-align-left .footer-heading::after {
    left: 0 !important;
    right: auto !important;
    transform: none !important;
}

.footer-box.footer-align-left .sw-footer-about {
    align-items: flex-end;
    text-align: left;
}

.footer-box.footer-align-left .sw-footer-about .sw-footer-logo {
    align-self: flex-end;
}

.footer-box.footer-align-left .sw-footer-social,
.footer-box.footer-align-left .social-links ul {
    justify-content: flex-end;
}

.footer-box.footer-align-left .sw-terms-widget.sw-terms-style-pills .sw-terms-list {
    justify-content: flex-end;
}

/* =========================================================
 * 4. Widget Headings & Typography
 * ========================================================= */
.footer-box .widget-title h2,
.footer-box .widget-title h3,
.footer-box .footer-heading {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0 0 20px;
    padding-bottom: 12px;
    position: relative;
    letter-spacing: -0.2px;
}

.footer-box .widget-title h2::after,
.footer-box .widget-title h3::after,
.footer-box .footer-heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 44px;
    height: 3px;
    background: linear-gradient(90deg, #e11d48, var(--main-color, #07467c));
    border-radius: 3px;
}

.footer-box .widget-header {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 18px !important;
}

/* =========================================================
 * 5. Specific Widget Styling (About, Posts, Social, Links)
 * ========================================================= */

/* 1. About Widget */
.sw-footer-about {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sw-footer-about .sw-footer-logo-wrap {
    display: inline-flex;
    align-items: center;
}

.sw-footer-about .sw-footer-logo {
    max-height: 54px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    display: block;
    transition: opacity 0.25s ease;
}

/* Light Mode: Show light logo, hide dark logo */
body:not(.dark) .sw-footer-about .sw-footer-logo-light {
    display: block !important;
}
body:not(.dark) .sw-footer-about .sw-footer-logo-dark {
    display: none !important;
}

/* Dark Mode: Show dark logo, hide light logo */
body.dark .sw-footer-about .sw-footer-logo-dark {
    display: block !important;
}
body.dark .sw-footer-about .sw-footer-logo-light {
    display: none !important;
}

.sw-footer-about .sw-footer-text {
    font-size: 0.925rem;
    line-height: 1.8;
    margin: 0;
}

.sw-footer-about .sw-footer-text p {
    margin: 0 0 10px;
}

.sw-footer-about .sw-footer-text p:last-child {
    margin-bottom: 0;
}

/* 2. Links Widget */
.sw-footer-links-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sw-footer-links-list a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.25s ease;
    padding: 3px 0;
}

.sw-footer-links-list a::before {
    content: '‹';
    font-size: 1.1rem;
    line-height: 1;
    color: #e11d48;
    transition: transform 0.25s ease;
}

.sw-footer-links-list a:hover {
    transform: translateX(-4px);
}

.sw-footer-links-list a:hover::before {
    transform: translateX(-2px);
}

/* 3. Footer Posts Widget */
.sw-footer-posts {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sw-footer-post {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body:not(.dark) .sw-footer-post {
    border-bottom-color: #e2e8f0;
}

.sw-footer-post:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sw-footer-post .thumb {
    flex-shrink: 0;
    width: 72px;
    height: 54px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #1e293b;
}

.sw-footer-post .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.sw-footer-post:hover .thumb img {
    transform: scale(1.08);
}

.sw-footer-post .content {
    flex: 1;
    min-width: 0;
}

.sw-footer-post .content h3 {
    margin: 0 0 5px;
    font-size: 0.875rem;
    line-height: 1.5;
    font-weight: 600;
}

.sw-footer-post .content h3 a {
    text-decoration: none;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body:not(.dark) .sw-footer-post .content h3 a {
    color: #1e293b;
}

body:not(.dark) .sw-footer-post .content h3 a:hover {
    color: var(--main-color, #07467c);
}

body.dark .sw-footer-post .content h3 a {
    color: #e2e8f0;
}

body.dark .sw-footer-post .content h3 a:hover {
    color: #38bdf8;
}

.sw-footer-post .content .date {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
}

/* 4. Social Media Widget */
.sw-footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sw-footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body:not(.dark) .sw-footer-social a {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.dark .sw-footer-social a {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.sw-footer-social a svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

.sw-footer-social a:hover {
    transform: translateY(-2px);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sw-footer-social a.fb:hover { background: #1877f2 !important; border-color: #1877f2 !important; }
.sw-footer-social a.tw:hover { background: #000000 !important; border-color: #333333 !important; }
.sw-footer-social a.yt:hover { background: #ff0000 !important; border-color: #ff0000 !important; }
.sw-footer-social a.tg:hover { background: #229ed9 !important; border-color: #229ed9 !important; }
.sw-footer-social a.ig:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) !important; border-color: transparent !important; }
.sw-footer-social a.wa:hover { background: #25d366 !important; border-color: #25d366 !important; }

/* 5. Newsletter Widget */
.sw-footer-newsletter {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sw-footer-newsletter p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

.sw-footer-newsletter form {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.sw-footer-newsletter input[type="email"] {
    flex: 1;
    min-width: 0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease;
}

body:not(.dark) .sw-footer-newsletter input[type="email"] {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

body:not(.dark) .sw-footer-newsletter input[type="email"]:focus {
    border-color: var(--main-color, #07467c);
    box-shadow: 0 0 0 2px rgba(7, 70, 124, 0.15);
}

body.dark .sw-footer-newsletter input[type="email"] {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

body.dark .sw-footer-newsletter input[type="email"]:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--main-color, #07467c);
    box-shadow: 0 0 0 2px rgba(7, 70, 124, 0.25);
}

.sw-footer-newsletter button[type="submit"] {
    background: var(--main-color, #07467c);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sw-footer-newsletter button[type="submit"]:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* =========================================================
 * 6. Responsive Breakpoints
 * ========================================================= */
@media (max-width: 991px) {
    .footer-widget-grid.footer-cols-4,
    .footer-widget-grid.footer-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 30px 24px;
    }
}

@media (max-width: 640px) {
    .footer-box {
        padding: 35px 0 25px;
    }
    .footer-widget-grid,
    .footer-widget-grid.footer-cols-4,
    .footer-widget-grid.footer-cols-3,
    .footer-widget-grid.footer-cols-2,
    .footer-widget-grid.footer-single-sidebar-grid {
        grid-template-columns: 1fr !important;
        gap: 28px;
    }
}
