/* Custom styles for Priority 3 improvements */

/* Mobile optimizations */
@media (max-width: 768px) {
    /* Auto-collapse sidebar on mobile */
    .sidebar {
        width: 0 !important;
        min-height: 100vh;
        overflow-x: hidden;
        transition: width 0.15s ease-in-out;
    }
    
    /* When sidebar is toggled open on mobile */
    .sidebar-toggled .sidebar {
        width: 100% !important;
        position: fixed;
        z-index: 1001;
        top: 0;
        left: 0;
        /* Keep the original gradient background */
        background-color: #4e73df !important;
        background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%) !important;
    }
    
    /* Make content full width on mobile */
    #content-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
    }
    
    /* Style the toggle button to be more prominent */
    #sidebarToggleTop {
        background-color: #4e73df;
        color: white;
        border: none;
        padding: 0.5rem 0.75rem;
        border-radius: 0.35rem;
        box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    }
    
    #sidebarToggleTop:hover {
        background-color: #2e59d9;
    }
    
    /* Ensure sidebar content is properly styled on mobile */
    .sidebar .nav-item {
        width: 100%;
    }
    
    .sidebar .nav-link {
        text-align: left !important;
        padding: 1rem 1.5rem !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .sidebar .nav-link i {
        margin-right: 0.5rem !important;
        width: 1.25rem !important;
        text-align: center !important;
    }
    
    .sidebar .nav-link span {
        font-size: 1rem !important;
        display: inline !important;
    }
    
    .sidebar-brand {
        padding: 1rem 1.5rem !important;
        height: auto !important;
    }
    
    .sidebar-brand-text {
        display: inline !important;
        font-size: 1.2rem !important;
    }
    
    .sidebar-heading {
        padding: 0.5rem 1.5rem !important;
        font-size: 0.85rem !important;
        text-transform: uppercase !important;
    }
    
    /* Original mobile optimizations */
    .coupon .btn-copy {
        padding: 0.75rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .coupon .card-footer {
        padding: 1rem;
    }
    
    #coupon-filters {
        position: sticky;
        top: 0;
        background: white;
        z-index: 100;
        padding: 1rem 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

/* Tablet and smaller desktop adjustments */
@media (max-width: 992px) {
    .sidebar {
        width: 6.5rem !important;
    }
    
    .sidebar .nav-item .nav-link span {
        display: none;
    }
    
    .sidebar-brand-text {
        display: none;
    }
    
    .sidebar.toggled {
        width: 0 !important;
    }
}

/* FAQ Accordion styles */
.faq-section {
    margin-top: 3rem;
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid #e3e6f0;
    border-radius: 0.35rem;
    overflow: hidden;
}

.faq-item h3 {
    margin: 0;
    padding: 1rem;
    background: #f8f9fc;
    cursor: pointer;
    position: relative;
    font-size: 1.1rem;
}

.faq-item h3:after {
    content: '\f078'; /* Font Awesome chevron-down */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

.faq-item.active h3:after {
    transform: translateY(-50%) rotate(180deg);
}

.faq-content {
    padding: 1rem;
    display: none;
    background: white;
}

/* Breadcrumb styling */
.breadcrumb {
    background-color: transparent;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

/* Filter styles */
#coupon-filters {
    background: #f8f9fc;
    padding: 1.5rem;
    border-radius: 0.35rem;
    margin-bottom: 2rem;
}

#coupon-filters .form-group {
    margin-bottom: 1rem;
}

#coupon-search {
    font-size: 1.1rem;
    padding: 0.75rem;
}

/* Copy counter styles */
.copy-counter-wrapper {
    margin-top: 0.5rem;
    color: #6c757d;
}

.copy-counter {
    font-weight: bold;
    color: #4e73df;
}

/* Recently expired section */
.expired-section {
    margin-top: 3rem;
    opacity: 0.7;
}

.expired-section h2 {
    color: #858796;
}

/* Proper spacing between major sections */
.row + .row {
    margin-top: 2rem;
}

/* Reduce section spacing on mobile */
@media (max-width: 768px) {
    .row + .row {
        margin-top: 1.5rem;
    }
    
    .expired-section {
        margin-top: 2rem;
    }
}

/* Coupon card enhancements */
.coupon {
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
}

.coupon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Reduce spacing between coupons on mobile */
@media (max-width: 768px) {
    .coupon {
        margin-bottom: 1rem;
    }
}

/* Sort and filter indicators */
#coupon-count {
    text-align: center;
    font-style: italic;
    margin: 1rem 0;
}

/* Reduce coupon count margin on mobile */
@media (max-width: 768px) {
    #coupon-count {
        margin: 0.5rem 0;
        font-size: 0.9rem;
    }
}

/* Loading animation for filters */
.filter-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Category badges */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: #e3e6f0;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
}

.category-badge.new-users {
    background: #1cc88a;
    color: white;
}

.category-badge.eu-warehouse {
    background: #36b9cc;
    color: white;
}

/* Copy button styles */
.btn-copy.btn-light {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

.btn-copy.btn-light:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: #212529;
}

.btn-copy.btn-light:focus,
.btn-copy.btn-light:active {
    background-color: #e2e6ea !important;
    border-color: #dae0e5 !important;
    color: #212529 !important;
    box-shadow: 0 0 0 0.2rem rgba(216, 217, 219, 0.5) !important;
}

/* Ensure icon is visible in all states */
.btn-copy.btn-light .fa-clipboard {
    color: #6c757d;
}

.btn-copy.btn-light:hover .fa-clipboard {
    color: #495057;
}

/* Success state */
.btn-copy.btn-success {
    background-color: #1cc88a !important;
    border-color: #1cc88a !important;
    color: white !important;
}

.btn-copy.btn-success .fa-check {
    color: white !important;
}

/* Additional mobile sidebar fixes */
@media (max-width: 768px) {
    /* Hide sidebar by default on page load */
    body:not(.sidebar-toggled) .sidebar {
        width: 0 !important;
    }
    
    /* Overlay when sidebar is open */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Make sidebar slide from left */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1001;
        background-color: #4e73df !important;
        background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%) !important;
        overflow-y: auto;
    }
    
    /* Ensure proper text color for sidebar items on mobile */
    .sidebar .nav-link {
        color: rgba(255,255,255,.8) !important;
    }
    
    .sidebar .nav-link:hover {
        color: rgba(255,255,255,1) !important;
    }
    
    .sidebar .sidebar-heading {
        color: rgba(255,255,255,.4) !important;
    }
    
    .sidebar-divider {
        border-top: 1px solid rgba(255,255,255,.15) !important;
    }
    
    /* Sidebar brand styling on mobile */
    .sidebar .sidebar-brand {
        color: rgba(255,255,255,1) !important;
        background: transparent !important;
    }
    
    .sidebar .sidebar-brand:hover {
        color: rgba(255,255,255,1) !important;
    }
    
    /* Active nav item styling */
    .sidebar .nav-item.active .nav-link {
        color: rgba(255,255,255,1) !important;
        font-weight: 700;
    }
    
    /* Nav link icons */
    .sidebar .nav-link i {
        color: rgba(255,255,255,.8) !important;
    }
    
    .sidebar .nav-link:hover i {
        color: rgba(255,255,255,1) !important;
    }
    
    /* Ensure ads and iframes in sidebar don't break layout */
    .sidebar iframe,
    .sidebar ins {
        max-width: 100%;
        width: 100% !important;
    }
    
    /* Style sidebar ads container */
    .sidebar-ads {
        padding: 1rem 1.5rem;
        text-align: center;
        margin-top: 2rem;
        border-top: 1px solid rgba(255,255,255,.15);
    }
    
    .sidebar-ads img {
        max-width: 250px;
        width: 100%;
        height: auto;
        border-radius: 0.35rem;
    }
    
    /* Fix AdSense styling in sidebar */
    .sidebar .adsbygoogle {
        background: transparent !important;
        max-width: 300px;
        margin: 1rem auto;
    }
    
    /* Adjust sidebar scrolling */
    .sidebar {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure toggle button is always visible */
    #sidebarToggleTop {
        display: block !important;
    }
    
}

/* Close button for mobile sidebar */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,.8);
    font-size: 2.5rem;
    line-height: 1;
    padding: 5px 10px;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s;
    font-weight: 300;
}

.sidebar-close-btn:hover,
.sidebar-close-btn:focus {
    color: rgba(255,255,255,1);
    outline: none;
}

@media (max-width: 768px) {
    .sidebar-close-btn {
        display: block;
    }
}

/* AdBlock notification styles */
#blokinf {
    margin: 0;
    padding: 0;
}

/* AdBlock popup modal */
.adblock-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

.adblock-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.adblock-modal-content {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

.adblock-modal-header {
    background-color: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    position: relative;
}

.adblock-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

.adblock-modal-header i {
    margin-right: 10px;
    font-size: 1.5rem;
}

.adblock-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #721c24;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.adblock-modal-close:hover {
    opacity: 1;
}

.adblock-modal-body {
    padding: 25px;
    color: #333;
}

.adblock-modal-body p {
    margin: 0 0 15px 0;
    line-height: 1.6;
}

.adblock-modal-body .benefits {
    background-color: #f8f9fa;
    border-left: 4px solid #dc3545;
    padding: 15px;
    margin: 20px 0;
}

.adblock-modal-body .benefits ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.adblock-modal-body .benefits li {
    margin-bottom: 8px;
}

.adblock-modal-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #dee2e6;
}

.adblock-modal-footer .btn {
    padding: 10px 30px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.adblock-modal-footer .btn-primary {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.adblock-modal-footer .btn-primary:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .adblock-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .adblock-modal-header {
        padding: 15px;
    }
    
    .adblock-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .adblock-modal-body {
        padding: 20px;
    }
    
    .adblock-modal-footer {
        padding: 15px;
    }
}