:root {
    --primary-bg: #181818;
    --secondary-bg: #1f1f1f;
    --tertiary-bg: #252525;
    --card-bg: #2c2c2c;
    --primary-text: #e0e0e0;
    --secondary-text: #a0a0a0;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.7);
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--primary-bg);
    color: var(--primary-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 60px; /* Space for bottom navigation on mobile */
}

.navbar {
    background: var(--secondary-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-text) !important;
}

.deal-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.deal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-color);
}

.deal-card.sold-out {
    opacity: 0.3;
}

.deal-img-container {
    position: relative;
    padding-top: 75%; /* 4:3 aspect ratio */
    padding-top: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
}

.deal-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--tertiary-bg);
    transition: transform var(--transition-speed) ease;
}

.deal-card:hover .deal-img {
    transform: scale(1.08);
}

.deal-content {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.deal-title {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.deal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.badge-soft {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.badge-red {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fcd34d;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.deal-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.current-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
}

.original-price {
    font-size: 0.8rem;
    color: var(--secondary-text);
    text-decoration: line-through;
}

.progress-bar-container {
    position: relative;
    border-radius: 8px;
    height: 14px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    background: var(--primary-bg);
}

.progress-bar-fill {
    background-color: #ee4d2d;
    background-image: linear-gradient(to right, yellow, red);
    height: 100%;
    border-radius: 8px 0 0 8px;
}

.progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-text);
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}

.deal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-action {
    flex: 1;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-buy {
    background: var(--accent-blue);
    color: white;
    text-decoration: none;
}

.btn-buy:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-fav,
.btn-hide {
    background: transparent;
    color: var(--secondary-text);
    border: 1px solid var(--border-color);
}

.btn-fav.active {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.btn-fav:hover,
.btn-hide:hover {
    color: var(--primary-text);
    border-color: var(--primary-text);
}

.filter-section {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.filter-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary-text);
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pill {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-speed) ease;
    background: transparent;
    color: var(--secondary-text);
    white-space: nowrap;
}

.pill.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.pill:hover:not(.active) {
    border-color: var(--primary-text);
    color: var(--primary-text);
}

.toolbar {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.toolbar .btn-check + label {
    border-radius: 999px;
    font-size: 0.85rem;
}

.search-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text);
    z-index: 2;
}

.search-container .search-input {
    padding-left: 2.5rem;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    color: var(--primary-text);
    border-radius: 8px;
    transition: border-color var(--transition-speed) ease;
}

.search-container .search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.search-container .search-input::placeholder {
    color: var(--secondary-text) !important;
    opacity: 1;
}

.sort-select {
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    color: var(--primary-text);
    border-radius: 8px;
    padding: 0.5rem;
    transition: border-color var(--transition-speed) ease;
}

.sort-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.tabs-container {
    margin-bottom: 1rem;
}

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--secondary-text);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.nav-tabs .nav-link.active {
    color: var(--primary-text);
    background: transparent;
    border-bottom: 2px solid var(--accent-blue);
}

.nav-tabs .nav-link:hover {
    color: var(--primary-text);
    border-bottom: 2px solid var(--border-color);
}

.status-message {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--secondary-text);
}

.floating-actions {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all var(--transition-speed) ease;
    border: none;
    cursor: pointer;
}

.fab-primary {
    background: var(--accent-blue);
    color: white;
}

.fab-secondary {
    background: var(--card-bg);
    color: var(--primary-text);
    border: 1px solid var(--border-color);
}

.fab:hover {
    transform: scale(1.05);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1050;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px var(--shadow-color);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--secondary-text);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    margin-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.form-control,
.form-select {
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    color: var(--primary-text);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: border-color var(--transition-speed) ease;
}

.form-control:focus,
.form-select:focus {
    background: var(--tertiary-bg);
    color: var(--primary-text);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: transparent;
    color: var(--primary-text);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--tertiary-bg);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-outline-light {
    background: transparent;
    color: var(--primary-text);
    border: 1px solid var(--border-color);
}

.btn-outline-light:hover {
    background: var(--tertiary-bg);
}

.link-out {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

.link-out:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.muted {
    color: var(--secondary-text);
}

.countdown-timer {
    background: var(--accent-red);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--card-bg);
    border-left: 4px solid var(--accent-green);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    max-width: 300px;
    z-index: 1100;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.9rem;
    color: var(--secondary-text);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color var(--transition-speed) ease;
}

.bottom-nav-item.active {
    color: var(--accent-blue);
}

.bottom-nav-item:hover {
    color: var(--primary-text);
}

.bottom-nav-icon {
    font-size: 1.25rem;
}

.skeleton {
    background: linear-gradient(90deg, var(--tertiary-bg) 25%, var(--card-bg) 50%, var(--tertiary-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 0.8rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1rem;
    width: 80%;
    margin-bottom: 0.5rem;
}

.skeleton-img {
    height: 150px;
    width: 100%;
    margin-bottom: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .btn {
        padding: 0.25rem 0.5rem;
    }

    .deal-card {
        margin-bottom: 0.75rem;
    }

    .filter-section,
    .toolbar {
        padding: 0.35rem;
    }

    .modal-content {
        width: 95%;
        padding: 1rem;
    }

    .floating-actions {
        bottom: 70px; /* Above bottom nav */
    }

    .deal-content {
        padding: 0.25rem;
        flex-grow: initial;
    }
}

@media (max-width: 576px) {
    .deal-title {
        font-size: 0.85rem;
    }

    .current-price {
        font-size: 1rem;
    }

    .btn-action {
        padding: 0.2rem 0.2rem;
        font-size: 0.8rem;
    }
}
