/* assets/css/offers.css */
:root {
    --p-blue: #3498db;
    --p-blue-dark: #2980b9;
    --a-orange: #F0A34A;
    --bg-gray: #f4f7f6;
    --white: #ffffff;
}

/* Page hero styles inherited from global style.css */
.offers-page {
    background-color: #fff;
    direction: rtl;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin-top: 30px;
}

.content-area {
    min-width: 0;
    /* Important for grid overflow prevention */
}

/* Sidebar Categories */
.sidebar-nav {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: fit-content;
    position: sticky;
    top: 90px;
    z-index: 10;
}

.sidebar-header {
    background: var(--p-blue);
    color: white;
    padding: 15px;
    font-weight: bold;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cat-list a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #444;
    text-decoration: none;
    border-bottom: 1px solid #f1f1f1;
    font-weight: 600;
    transition: 0.3s;
    gap: 12px;
}

.cat-list a.active {
    background: #f0f7ff;
    color: var(--p-blue);
    border-right: 5px solid var(--a-orange);
}

.cat-list a i {
    color: var(--p-blue);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.cat-list a:hover {
    background: #f8f9fa;
}

/* Filter Panel */
.control-panel {
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.header-main-info {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Proximity between title and counter */
    flex-shrink: 0;
}

.filter-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-line-separator {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.line-blue {
    height: 3px;
    width: 30px;
    background-color: var(--color-primary-blue);
    border-radius: 2px;
}

.line-orange {
    height: 3px;
    width: 15px;
    background-color: var(--color-secondary-orange);
    border-radius: 2px;
}

/* Offer Counter Badge */
.offer-total-badge {
    background: #eef2f7;
    color: var(--p-blue-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid #dce4ec;
    white-space: nowrap;
}

.offers-filter-inline {
    margin: 0;
}

.filter-flex-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Filter Item Wrapper for Dot */
.filter-item-wrapper {
    position: relative;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-item label {
    font-size: 0.8rem;
    color: #777;
    font-weight: 700;
    white-space: nowrap;
}

.filter-item label i {
    color: var(--a-orange);
    /* Orange icons */
    margin-left: 3px;
}

.refined-select {
    padding: 5px 10px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-weight: 600;
    color: #333;
    outline: none;
    cursor: pointer;
    min-width: 100px;
    /* More stable on mobile */
    height: 36px;
    font-size: 0.85rem;
    transition: 0.3s;
}

.btn-refresh-offers {
    background: #f8f9fa;
    border: 1.5px solid #ddd;
    color: #555;
    width: 34px;
    /* Reduced Size */
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Individual Filter Dots */
.filter-item-wrapper.has-active-filter::after,
.mobile-filter-toggle.has-active-filter::after {
    content: '';
    position: absolute;
    top: -2px;
    /* Adjusted to stay within bounds */
    right: -2px;
    /* Adjusted to stay within bounds */
    width: 10px;
    height: 10px;
    background: #e74c3c;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 5;
}

/* Offer Cards */
.offers-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
    max-width: 100%;
}

.offer-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #eee;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.offer-card-header {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f8f8f8;
}

.offer-header-main {
    display: flex;
    align-items: center;
}

.offer-header-info {
    display: flex;
    gap: 10px;
}

.offer-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cat-badge {
    background: #fff8f0;
    color: var(--a-orange);
    border: 1px solid #feeacf;
}

.dist-badge {
    background: #f0f7ff;
    color: var(--p-blue);
    border: 1px solid #dceeff;
}

.offer-tech-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: 12px;
}

.offer-tech-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
}

.offer-date {
    font-size: 0.8rem;
    color: #999;
    display: block;
}

.offer-card-body {
    padding: 20px;
    overflow: hidden;
    /* Clearfix for floated image */
}

.offer-image-wrapper {
    position: relative;
    float: left;
    margin: 5px 25px 15px 0;
    /* Increased margin for distance */
    width: 150px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid #fff;
}

.offer-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.offer-image:hover {
    transform: scale(1.05);
}

.btn-zoom-image {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
}

.offer-image-wrapper:hover .btn-zoom-image {
    opacity: 1;
}

.offer-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.4;
}

.offer-text {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
    text-align: justify;
}

.offer-counters {
    display: flex;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    gap: 20px;
    font-size: 0.9rem;
    font-weight: 700;
}

.counter-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.counter-likes i {
    color: #ff4757;
    /* Vibrant Red */
}

.counter-clicks i {
    color: #2ed573;
    /* Vibrant Green */
}

.offer-actions {
    display: flex;
    padding: 10px 20px;
    gap: 10px;
    border-top: 1px solid #f0f0f0;
}

.btn-offer-like,
.btn-offer-contact {
    padding: 8px 15px;
    font-size: 0.9rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.3s;
    border: none;
    text-decoration: none;
    flex: 1;
}

.btn-offer-like {
    background: #f8f9fa;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.btn-offer-like.active {
    background: #e74c3c;
    color: white;
}

.btn-offer-contact {
    background: linear-gradient(135deg, #F0A34A, #F5AE5A);
    color: white;
}

.btn-offer-contact:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* No Results */
.no-results-container {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.no-results-container i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

/* Loader */
#load-more-container {
    text-align: center;
    margin: 30px;
}

.spinner {
    display: none;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--a-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.btn-load-more {
    background: var(--p-blue);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 18px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.3s;
}

.btn-load-more:hover {
    background: var(--p-blue-dark);
    transform: translateY(-2px);
}

/* Mobile Filter */
.mobile-filters-section {
    display: none;
    margin-bottom: 20px;
}

.mobile-filter-toggle {
    width: 100%;
    background: white;
    border: 2px solid var(--color-secondary-orange);
    color: var(--color-secondary-orange);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Active Filter Red Dot */
.mobile-filter-toggle.has-active-filter {
    position: relative;
    border-color: #e74c3c;
    color: #e74c3c;
}

.mobile-filter-toggle.has-active-filter::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 5;
}

.mobile-filter-container {
    max-height: 0;
    overflow: hidden;
    transition: 0.4s ease;
    background: white;
    border-radius: 0 0 10px 10px;
    border: 1px solid #eee;
    border-top: none;
}

.mobile-filter-container.active {
    max-height: 100px;
    padding: 15px;
}

.mobile-form-select-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.mobile-form-icon {
    position: absolute;
    right: 15px;
    color: var(--a-orange);
}

.mobile-form-select {
    width: 100%;
    padding: 8px 35px 8px 25px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    appearance: none;
}

.mobile-select-arrow {
    position: absolute;
    left: 15px;
    color: var(--a-orange);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 992px) {
    .main-layout {
        display: block;
        margin-top: 20px;
    }

    .sidebar-nav {
        display: none;
    }

    .mobile-filters-section {
        display: block;
        margin-bottom: 20px;
    }

    .content-area {
        width: 100%;
    }
}

@media (max-width: 768px) {

    /* Fixed Mobile Layout */
    .offers-page {
        width: 100%;
        overflow-x: hidden;
    }

    .page-hero {
        width: 100%;
        margin: 0;
        padding: 40px 0;
    }

    .page-hero .container {
        padding: 0 15px;
    }

    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .main-layout {
        width: 100%;
        margin-top: 20px;
        display: block;
    }

    .control-panel {
        padding: 10px !important;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        max-width: 100%;
        margin: 0 !important;
        box-sizing: border-box;
    }

    .offers-filter-inline {
        order: 2;
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    .filter-flex-row {
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .filter-item-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .filter-item {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .filter-item label {
        display: block;
        font-size: 0.7rem;
        min-width: auto;
        margin-bottom: 3px;
    }

    .header-main-info {
        order: 1;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 10px;
        width: 100%;
    }

    .filter-header {
        width: 100%;
    }

    .filter-header h2 {
        font-size: 0.95rem !important;
        gap: 5px;
        margin-bottom: 5px;
        display: flex;
        align-items: center;
    }

    .filter-header h2 i {
        font-size: 0.85rem;
    }

    .title-line-separator {
        display: flex;
        gap: 3px;
        height: 2px;
    }

    .line-blue,
    .line-orange {
        height: 2px;
    }

    .refined-select {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        font-size: 0.75rem !important;
        height: 34px;
        padding: 5px 8px !important;
        border-radius: 6px;
    }

    .btn-refresh-offers {
        align-self: flex-end;
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
        padding: 5px;
    }

    .offer-total-badge {
        font-size: 0.7rem !important;
        padding: 3px 8px !important;
        white-space: nowrap;
    }

    /* Offer Header Mobile */
    .offer-card-header {
        padding: 8px 10px !important;
        flex-wrap: wrap;
        gap: 5px;
    }

    .offer-badge {
        padding: 2px 6px;
        font-size: 0.6rem;
        border-radius: 3px;
    }

    .offer-date {
        font-size: 0.65rem !important;
    }

    /* Improved Offer Card Mobile Layout */
    .offer-card {
        margin-bottom: 12px !important;
        border-radius: 8px;
    }

    .offer-card-body {
        padding: 12px 15px !important;
        display: block;
        /* Allow float */
        text-align: right;
        /* RTL text */
        overflow: hidden;
        /* Clearfix */
    }

    .offer-image-wrapper {
        float: right;
        /* Stick to right */
        margin: 0 0 10px 12px;
        /* Bottom and Left margins */
        width: 80px;
        /* Smaller width */
        height: 80px;
        /* Smaller height */
        border-radius: 6px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .offer-title {
        font-size: 0.95rem !important;
        margin-bottom: 6px;
        line-height: 1.3;
        font-weight: 700;
    }

    .offer-text {
        font-size: 0.8rem !important;
        line-height: 1.5;
        text-align: justify;
        color: #555;
    }

    /* Smaller actions/buttons */
    .offer-actions {
        padding: 8px 12px !important;
        gap: 8px;
    }

    .btn-offer-like,
    .btn-offer-contact {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        height: 32px;
        border-radius: 6px;
    }

    .offer-counters {
        padding: 8px 12px !important;
        font-size: 0.75rem !important;
        gap: 15px;
        justify-content: flex-start;
        /* Align start */
    }

    /* Push Mobile Filter Down Slightly */
    .mobile-filters-section {
        margin-top: 10px;
        margin-bottom: 15px;
    }

}

.offer-counters .counter-item {
    font-size: 0.7rem;
}

.offer-actions {
    padding: 8px;
    gap: 8px;
}

.btn-offer-like,
.btn-offer-contact {
    padding: 8px 10px !important;
    font-size: 0.75rem !important;
    border-radius: 6px;
}

/* Extra small devices (phones, less than 375px) */
@media (max-width: 375px) {
    .container {
        padding: 0 10px !important;
    }

    .control-panel {
        padding: 8px !important;
    }

    .filter-header h2 {
        font-size: 0.85rem !important;
    }

    .offer-image-wrapper {
        max-width: 200px;
        height: 140px;
    }

    .offer-title {
        font-size: 0.85rem !important;
    }

    .offer-text {
        font-size: 0.75rem !important;
    }

    .btn-offer-like,
    .btn-offer-contact {
        padding: 6px 8px !important;
        font-size: 0.7rem !important;
    }
}

/* --- Image Zoom Modal --- */
.image-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.zoom-modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.close-zoom {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.close-zoom:hover {
    color: var(--a-orange);
}

/* --- Login Confirmation Modal --- */
.login-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.login-confirm-content {
    background-color: white;
    padding: 35px;
    border-radius: 15px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Offer Footer & Stats --- */
.offer-footer {
    background: #f8f9fa;
    padding: 8px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.offer-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

.offer-counters-compact {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    font-weight: bold;
}

.counter-item.counter-likes {
    color: #ff4757;
}

.counter-item.counter-clicks {
    color: #2ed573;
}

.counter-item.counter-likes::after {
    content: ' إعجاب';
    font-size: 0.7rem;
    color: #888;
    font-weight: normal;
    margin-right: 3px;
}

.counter-item.counter-clicks::after {
    content: ' تواصلوا';
    font-size: 0.7rem;
    color: #888;
    font-weight: normal;
    margin-right: 3px;
}

@media (max-width: 768px) {
    .offer-footer {
        flex-direction: column-reverse;
        /* يجعل الإحصائيات فوق الأزرار */
        gap: 12px;
        padding: 12px 15px;
        align-items: stretch;
        text-align: center;
    }

    .offer-btns {
        width: 100%;
        justify-content: center;
    }

    .offer-counters-compact {
        width: 100%;
        justify-content: center;
        border-bottom: 1px solid #eee;
        padding-bottom: 8px;
    }
}

.login-confirm-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 800;
}

.login-confirm-content p {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
    font-size: 1rem;
}

.login-confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.login-confirm-buttons button {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    transition: 0.3s;
    font-size: 0.95rem;
}

.btn-confirm-login {
    background: #27ae60;
    color: white;
    flex: 1;
}

.btn-confirm-login:hover {
    background: #219150;
    transform: translateY(-2px);
}

.btn-cancel-login {
    background: #e74c3c;
    color: white;
    flex: 1;
}

.btn-cancel-login:hover {
    background: #c0392b;
    transform: translateY(-2px);
}