* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #8B0000; 
    --primary-dark: #650000;
    --primary-light: #d88080;
    --secondary-color: #f3b712;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f9f9f9;
    --card-bg: white;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-radius: 12px;
}

html {
    overflow-x: hidden;
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%; /* Ensure full width */
    position: relative; /* Contain absolutely positioned elements */
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
    text-align: left; /* Ensure text aligns left */
}

.top-nav {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 0;
    min-height: 60px; /* Set a minimum height instead of fixed height */
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s ease;
}

.top-nav.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logo {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

main {
    padding: 30px 0;
    padding-top: 15px;
    overflow-x: hidden; /* Prevent horizontal scroll in main content */
    width: 100%;
    max-width: 100vw; /* Ensure it doesn't exceed viewport width */
    flex: 1;
    margin-bottom: 0;
}

h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.3px;
    position: relative;
    display: inline-block;
}

h2::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* Filter Section Styles */
.filter-section {
    background-color: var(--card-bg);
    padding: 25px;
    margin-bottom: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-button {
    display: none;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.toggle-button:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    transition: var(--transition);
    max-height: 1000px;
    overflow: hidden;
}

.filter-group {
    flex: 1 1 200px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
    font-size: 15px;
}

select, input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: var(--transition);
    background-color: rgba(255, 255, 255, 0.8);
}

select:focus, input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.filter-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
}

.filter-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.filter-button:active {
    transform: translateY(0);
}

/* Sponsored Plates Carousel - Native smooth scrolling */
.sponsored-section {
    margin-bottom: 40px;
}

.sponsored-plates {
    display: flex;
    overflow-x: auto;
    gap: 25px;
    padding: 10px 0 20px;
}

.sponsored-plates .plate-card {
    flex: 0 0 auto;
}

/* Plates Grid Styles */
.plates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    contain: layout style;
    will-change: contents;
}

/* Additional styling */
.loading-message, .error-message, .no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 16px;
    width: 100%;
    grid-column: 1 / -1;
}

.error-message {
    color: var(--primary-color);
}

.filtering {
    position: relative;
    overflow: hidden;
}

.filtering::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shine 1s ease;
}

@keyframes shine {
    to { left: 100%; }
}

/* Divider Styles */
.section-divider {
    width: 100%;
    height: 0;
    border-bottom: 1.5px solid var(--border-color);
    margin: 32px 0 24px 0;
    opacity: 0.7;
}

/* Section Box Styles */
.section-box {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden; /* Prevent content overflow */
    width: 100%; /* Full width of container */
    box-sizing: border-box;
}

/* Cart Icon Styles */
.cart-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-left: auto;
    padding: 0 8px;
}

.cart-icon-mobile {
    display: none;
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(139,0,0,0.10);
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    z-index: 200;
    border: 2px solid #e9e9e9;
    flex-direction: column;
}

.cart-icon-mobile svg {
    display: block;
    margin: auto;
}

.top-nav .cart-icon svg path {
    stroke: #ffffff !important;
}

.top-nav .cart-icon {
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.top-nav .cart-icon:hover {
    transform: scale(1.08);
    opacity: 0.9;
}

/* Ensure mobile FAB keeps original (dark) stroke */
.cart-icon-mobile svg path {
    stroke: #8B0000;
}

@media (max-width: 768px) {
    #cart-icon-desktop {
        display: none !important;
    }
    .cart-icon-mobile {
        display: flex !important;
    }
}

/* Mobile full-width styling for All Plates section */
@media (max-width: 768px) {
    .all-plates-section.section-box {
        /* stretch to screen edges (container has 20px horizontal padding) */
        margin-left: -20px;
        margin-right: -20px;
        width: calc(100% + 40px);
        border-radius: 24px 24px 0 0;
        /* only top corners rounded act as a divider */
        padding-top: 28px;
        padding-bottom: 32px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px; /* Even smaller padding on very small screens */
    }
    
    .section-box {
        padding: 20px 15px; /* Reduce internal padding */
        border-radius: 12px;
    }
    
    /* Adjust sponsored plates carousel for small screens */
    .sponsored-plates {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .plates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .plates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Make filter section responsive on mobile */
    .filter-section {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .toggle-button {
        display: block;
    }
    
    .filters {
        max-height: 0;
        opacity: 0;
        margin-top: 0;
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .filters.active {
        max-height: 1000px;
        opacity: 1;
        margin-top: 15px;
    }
    
    .filter-group {
        margin-bottom: 15px;
        width: 100%;
    }
    
    .filter-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .filter-group select,
    .filter-group input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .filter-button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }
    
    .plates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Ensure main container doesn't have extra bottom padding */
@media (max-width: 768px) {
    main.container {
        padding-bottom: 30px; /* Normal padding */
    }
}

/* Favorites Modal Styles */
.favorites-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.favorites-modal.active {
    opacity: 1;
}

.favorites-modal.closing {
    opacity: 0;
}

.favorites-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.favorites-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.favorites-modal.active .favorites-content {
    transform: translateY(0);
}

.favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.favorites-header h3 {
    margin: 0;
    color: var(--primary-color, #8B0000);
    font-size: 20px;
}

.favorites-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    color: #555;
}

.favorites-items {
    overflow-y: auto;
    padding: 16px;
    max-height: calc(80vh - 70px);
}

.favorite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.favorite-item:hover {
    background-color: #f9f9f9;
    transform: translateY(-1px);
}

.favorite-item:active {
    background-color: #f0f0f0;
}

.favorite-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    pointer-events: none;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.favorite-item:hover::after {
    border-color: rgba(139, 0, 0, 0.1);
}

.favorite-remove {
    z-index: 2; /* Ensure button is above the clickable area */
}

.favorite-plate {
    font-weight: 600;
    font-size: 20px;
    color: var(--text-color, #333);
}

.favorite-price {
    color: var(--primary-color, #8B0000);
    font-weight: 500;
}

.favorite-remove {
    background-color: #f0f0f0;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.favorite-remove:hover {
    background-color: #e0e0e0;
}

/* Empty state in favorites modal */
.no-favorites {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.empty-state-icon {
    font-size: 28px;
    margin-bottom: 15px;
}

.empty-state-hint {
    font-size: 14px;
    color: #888;
    margin-top: 10px;
    max-width: 250px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}

/* Account Settings Modal */
.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-modal.active {
    opacity: 1;
}

.settings-modal.closing {
    opacity: 0;
}

.settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.settings-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.settings-modal.active .settings-content {
    transform: translateY(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.settings-header h3 {
    margin: 0;
    color: var(--primary-color, #8B0000);
    font-size: 20px;
}

.settings-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    color: #555;
}

.settings-body {
    overflow-y: auto;
    padding: 20px;
    max-height: calc(90vh - 60px);
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.settings-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #888;
    margin-bottom: 0;
}

.settings-group input[type="text"],
.settings-group input[type="email"],
.settings-group input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.settings-group input[type="text"]:focus,
.settings-group input[type="email"]:focus,
.settings-group input[type="tel"]:focus {
    border-color: var(--primary-color, #8B0000);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.settings-group input[disabled] {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Toggle switches */
.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color, #8B0000);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.settings-actions {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
}

.settings-save {
    background: linear-gradient(to right, #8B0000, #a50000);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-save:hover {
    background: linear-gradient(to right, #a50000, #c10000);
    transform: translateY(-2px);
}

.settings-save.success {
    background: linear-gradient(to right, #2ecc71, #27ae60);
}

/* Upload Plate Button - restyled as a + button */
.upload-plate-btn {
    background-color: #8B0000; /* Match the primary color */
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(139, 0, 0, 0.3);
    position: relative;
}

.upload-plate-btn::before {
    content: "+";
    font-weight: 400;
}

.upload-plate-btn:hover {
    background-color: #a50000; /* Slightly lighter on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(139, 0, 0, 0.4);
}

.upload-plate-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(139, 0, 0, 0.3);
}

/* Tooltip for the upload button */
.upload-plate-btn::after {
    content: "Upload Plate";
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    font-weight: normal;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.upload-plate-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Upload Plate Modal */
.upload-plate-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.upload-plate-modal.active {
    display: flex;
}

.upload-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.upload-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    padding: 25px;
    overflow-y: auto;
    z-index: 1;
}

.close-upload {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
}

.upload-content h2 {
    margin: 0 0 20px;
    color: var(--primary-color, #8B0000);
    font-size: 24px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

/* Form Styling */
.upload-plate-form .form-group {
    margin-bottom: 20px;
}

.upload-plate-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.upload-plate-form input[type="text"],
.upload-plate-form input[type="number"],
.upload-plate-form input[type="tel"],
.upload-plate-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.upload-plate-form input:focus,
.upload-plate-form textarea:focus {
    border-color: var(--primary-color, #8B0000);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.upload-box {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.3s;
}

.upload-box:hover {
    border-color: #bbb;
}

.select-photo-btn {
    background-color: #f5f5f5;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.select-photo-btn:hover {
    background-color: #e5e5e5;
}

.photo-preview {
    display: none;
    margin-top: 15px;
    max-width: 100%;
    text-align: center;
}

.photo-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
}

.upload-submit-btn {
    background: linear-gradient(to right, #8B0000, #a50000);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 25px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.upload-submit-btn:hover {
    background: linear-gradient(to right, #a50000, #c10000);
    transform: translateY(-2px);
}

/* My Plates Modal */
.my-plates-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.my-plates-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.my-plates-modal.closing {
    opacity: 0;
}

.my-plates-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.my-plates-modal .modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.25s ease-out;
    z-index: 1;
}

.my-plates-modal.active .modal-content {
    transform: translateY(0);
}

.my-plates-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.my-plates-modal .modal-header h3 {
    margin: 0;
    color: var(--primary-color, #8B0000);
    font-size: 20px;
}

.my-plates-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    color: #555;
}

.my-plates-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

.my-plates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.no-plates {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

.empty-state-icon {
    font-size: 32px;
    margin-bottom: 15px;
}

.empty-state-hint {
    font-size: 14px;
    color: #888;
    margin-top: 10px;
    max-width: 250px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}

.plate-owner-actions {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid #eee;
}

.edit-plate-btn,
.delete-plate-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.edit-plate-btn {
    background-color: #f0f0f0;
    color: #333;
    flex: 1;
}

.delete-plate-btn {
    background-color: #fff1f1;
    color: #e74c3c;
}

.edit-plate-btn:hover {
    background-color: #e0e0e0;
}

.delete-plate-btn:hover {
    background-color: #ffe5e5;
}

/* TikTok toggle button in navbar - visible on all screens */
.nav-tiktok-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex; /* Always display the button */
    align-items: center;
    justify-content: center;
}

.nav-tiktok-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.nav-tiktok-toggle svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Language toggle button */
.nav-language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 16px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.nav-language-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.nav-language-toggle .language-text {
    color: #fff;
    font-weight: 700;
}

.nav-language-toggle .language-alt {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.nav-language-toggle svg {
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.3s ease;
}

.nav-language-toggle:hover svg {
    transform: rotate(90deg);
}

/* Active state when Arabic is selected */
.nav-language-toggle.arabic .language-text {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.nav-language-toggle.arabic .language-alt {
    color: #fff;
    font-weight: 700;
}

/* Dark mode support for language toggle */
body.dark-theme .nav-language-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-theme .nav-language-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Footer Styles */
.site-footer {
    background-color: #1a1a1a;
    color: #f5f5f5;
    padding: 40px 0 20px;
    margin-top: 80px;
    /* Ensure footer extends to bottom */
    min-height: 200px;
    position: relative;
    margin-bottom: 0;
}

/* Ensure body has no margin at bottom */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Make main content grow to push footer down */
main {
    flex: 1;
    /* Remove any bottom margin */
    margin-bottom: 0;
}

/* Footer Styles continued */
.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
    align-items: start;
}

.footer-brand h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}

.footer-brand p {
    color: #999;
    font-size: 14px;
    line-height: 1.6;
}

.footer-contact h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #fff;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #fff;
}

.footer-link svg {
    flex-shrink: 0;
    stroke: currentColor;
    transition: transform 0.3s ease;
}

.footer-link:hover svg {
    transform: scale(1.1);
}

/* Instagram icon specific color on hover */
.footer-link:hover svg:has(rect) {
    stroke: #E4405F;
}

/* Email icon specific color on hover */
.footer-link:hover svg:has(polyline) {
    stroke: #EA4335;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
    color: #666;
    font-size: 13px;
}

/* Footer FAQ Section - Accordion Style */
.footer-faq {
    margin-top: 40px;
    border-top: 1px solid #333;
    padding-top: 30px;
}

.footer-faq h4 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.faq-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.faq-item {
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.05);
}

.faq-question h5 {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    flex: 1;
}

.faq-icon {
    color: #fff;
    font-size: 20px;
    font-weight: 300;
    margin-left: 15px;
    transition: transform 0.3s ease;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.faq-answer.open {
    max-height: 200px;
}

.faq-answer p {
    color: #ccc;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

/* Mobile responsiveness for FAQ */
@media (max-width: 768px) {
    .footer-faq {
        margin-top: 30px;
        padding-top: 20px;
    }
    
    .faq-grid {
        gap: 12px;
    }
    
    .faq-question {
        padding: 15px;
    }
    
    .faq-question h5 {
        font-size: 14px;
    }
    
    .faq-answer p {
        font-size: 13px;
        padding: 15px;
    }
    
    .faq-answer.open {
        max-height: 300px;
    }
}

/* Mobile responsiveness for footer */
@media (max-width: 768px) {
    .site-footer {
        margin-top: 60px;
        padding: 30px 0 15px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .footer-links {
        align-items: center;
    }
    
    .footer-link {
        justify-content: center;
    }
}

/* Ensure footer doesn't overlap with mobile filter FAB */
@media (max-width: 768px) {
    main {
        padding-bottom: 80px; /* Space for FAB */
    }
}

/* SEO content styling - hidden visually but available for search engines */
.seo-content {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.seo-content h3, 
.seo-content h4, 
.seo-content p, 
.seo-content ul {
    margin: 0;
    padding: 0;
}

/* Performance optimizations */
.plates-grid {
    contain: layout style;
    will-change: contents;
}

.plate-card {
    contain: layout style paint;
    transform: translateZ(0); /* Enable hardware acceleration */
}

/* Reduce repaints during scrolling */
.sponsored-plates {
    contain: layout;
    transform: translateZ(0);
}

/* Optimize animations */
.plate-card:hover {
    will-change: transform;
}

.plate-card:not(:hover) {
    will-change: auto;
}

/* Smooth infinite scroll animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.plate-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.plate-card.fade-in {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading indicator styles */
#loading-indicator {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin: 10px auto;
    max-width: 300px;
    backdrop-filter: blur(5px);
}

/* Optimize scrolling performance */
.plates-grid {
    will-change: scroll-position;
    backface-visibility: hidden;
    perspective: 1000;
}

/* Smooth transitions for batch loading */
.plate-card-batch {
    animation: batchFadeIn 0.5s ease-out;
}

@keyframes batchFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* About icon fix - ensure question mark displays properly */
.nav-link[href="about.html"] {
    position: relative;
}

.nav-link[href="about.html"] .nav-icon {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: bold;
    font-size: 1.1em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: currentColor;
    color: white;
    text-align: center;
    margin-right: 8px;
}

/* Alternative: Use info icon instead of question mark */
.nav-link[href="about.html"]:before {
    content: "ℹ";
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 8px;
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    background: currentColor;
    color: white;
}

/* Hide the original icon if using the :before pseudo-element */
.nav-link[href="about.html"] .nav-icon {
    display: none;
}

/* Mobile responsiveness for about icon */
@media (max-width: 768px) {
    .nav-link[href="about.html"]:before {
        width: 20px;
        height: 20px;
        line-height: 20px;
        font-size: 1.1em;
        margin-right: 6px;
    }
}

/* Dark mode transitions */
html, body, .section-box, .site-footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Apply modern font stack site-wide */
html, body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Add extra spacing between navbar and sponsored section */
.sponsored-section {
    margin-top: 40px; /* Increased from default */
}

/* Dark theme specific styles */
html.dark-theme,
body.dark-theme {
    background: linear-gradient(135deg, #260202 0%, #000000 100%) !important;
    color: #e0e0e0 !important;
}

body.dark-theme .section-box {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
    border: 1px solid #404040 !important;
}

body.dark-theme .site-footer {
    background-color: #000000 !important;
    color: #e0e0e0 !important;
}

/* Also update input fields in dark mode */
body.dark-theme input, 
body.dark-theme select, 
body.dark-theme textarea {
    background-color: #404040 !important;
    color: #e0e0e0 !important;
    border: 1px solid #555555 !important;
}

body.dark-theme input::placeholder,
body.dark-theme select::placeholder,
body.dark-theme textarea::placeholder {
    color: #aaa !important;
}

body.dark-theme .plate-card {
    background-color: #333333 !important;
    border: 1px solid #555555 !important;
    color: #e0e0e0 !important;
}

body.dark-theme .filter-header h2,
body.dark-theme .sponsored-section h2,
body.dark-theme .all-plates-section h2 {
    color: #ffffff !important;
}

body.dark-theme input, 
body.dark-theme select, 
body.dark-theme textarea {
    background-color: #404040 !important;
    color: #e0e0e0 !important;
    border: 1px solid #555555 !important;
}

body.dark-theme input::placeholder,
body.dark-theme select::placeholder,
body.dark-theme textarea::placeholder {
    color: #aaa !important;
}

/* RTL (Arabic) Layout Support - Shift specific headers to the right */

/* Only these three specific headers should be shifted to the right in Arabic */
body.rtl .sponsored-section h2,
body.rtl .filter-header h2,
body.rtl .all-plates-section h2 {
    text-align: right;
    margin-left: auto;
    margin-right: 0;
    display: block;
    width: fit-content;
    margin-left: auto;
    position: relative;
}

/* Move the red underline/border to start from the right */
body.rtl .sponsored-section h2::after,
body.rtl .filter-header h2::after,
body.rtl .all-plates-section h2::after {
    right: 0 !important;
    left: auto !important;
    transform-origin: right center !important;
}

/* If there's a border-bottom, align it to the right */
body.rtl .sponsored-section h2,
body.rtl .filter-header h2,
body.rtl .all-plates-section h2 {
    border-image-source: linear-gradient(to left, #8B0000, transparent) !important;
    border-image-slice: 1 !important;
}

/* Keep the filter header layout intact but shift the h2 */
body.rtl .filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.rtl .filter-header h2 {
    order: 2; /* Move h2 to the right */
    margin-left: auto;
    margin-right: 0;
}

body.rtl .filter-header .toggle-button {
    order: 1; /* Keep button on the left */
    margin-right: auto;
    margin-left: 0;
}

/* RTL footer align fix: place header and links on the right and stack neatly */
body.rtl .footer-contact {
    text-align: right !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
}

body.rtl .footer-contact h4 {
    text-align: right !important;
    width: 100% !important;
}

body.rtl .footer-links {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 0.75rem !important;
}

body.rtl .footer-link {
    display: inline-flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    justify-content: flex-end !important;
    text-align: right !important;
}

body.rtl .footer-link svg {
    margin-left: 8px !important;
    margin-right: 0 !important;
}

/* Keep everything else normal - no RTL changes */
body.rtl {
    direction: ltr; /* Keep LTR for overall layout */
}

body.rtl .container {
    direction: ltr;
    text-align: left;
}

body.rtl .section-box {
    text-align: left;
}

body.rtl .filter-group {
    text-align: left;
}

/* Footer stays completely normal */
body.rtl .site-footer,
body.rtl .footer-content,
body.rtl .footer-brand,
body.rtl .footer-contact,
body.rtl .footer-faq,
body.rtl .footer-brand h3,
body.rtl .footer-contact h4,
body.rtl .footer-faq h4 {
    text-align: right;
    direction: rtl;
}

/* RTL Footer Layout */
body.rtl .footer-content {
    flex-direction: row-reverse;
}

body.rtl .footer-brand {
    text-align: right;
}

body.rtl .footer-contact {
    text-align: right;
}

body.rtl .footer-links {
    align-items: flex-end;
    text-align: right;
}

body.rtl .footer-link {
    flex-direction: row-reverse;
    justify-content: flex-end;
    text-align: right;
}

body.rtl .footer-link svg {
    margin-left: 8px;
    margin-right: 0;
}

/* Ensure footer sections stay aligned on same level */
body.rtl .footer-brand,
body.rtl .footer-contact {
    align-self: flex-start;
    vertical-align: top;
}

/* Make sure "تواصل معنا" and links align properly */
body.rtl .footer-contact h4 {
    margin-bottom: 1rem;
    text-align: right;
}

body.rtl .footer-links {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

body.rtl .faq-question {
    text-align: right;
    flex-direction: row-reverse;
}

body.rtl .faq-question h5 {
    text-align: right;
}

body.rtl .faq-icon {
    margin-left: 0;
    margin-right: auto;
}

body.rtl .footer-bottom {
    text-align: right;
}

body.rtl input,
body.rtl select,
body.rtl textarea {
    text-align: left;
}