:root {
    --primary-color: #0047AB;
    /* Cobalt Blue from logo/image */
    --primary-hover: #003380;
    --brand-orange: #FF6600;
    /* Vibrant Orange for accents */
    --header-bg: #0B1221;
    /* Dark Bluish Black */
    --border-color: #E2E8F0;
    --background-color: #F8FAFC;
    --card-background: #FFFFFF;
    --text-dark: #0F172A;
    --text-light: #475569;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-dark);
}

.main-nav {
    background-color: var(--header-bg);
    border-bottom: 4px solid var(--brand-orange);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.container-box {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.search-bar-wrapper {
    position: relative;
}

.search-bar {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding-right: 2.5rem;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.3);
}

.clear-search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    display: none;
}

.btn {
    transition: all 0.2s ease-in-out;
    border-radius: 0.375rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 71, 171, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #002266);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 71, 171, 0.4);
}

.btn-secondary {
    background-color: white;
    color: var(--text-dark);
    border: 1px solid #CBD5E1;
}

.btn-secondary:hover {
    background-color: #F1F5F9;
    border-color: #94A3B8;
}

/* Specific override for white backgrounds (like the body) where secondary buttons are used */
.main-nav .btn-secondary {
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    background-color: transparent;
}

.main-nav .btn-secondary:hover {
    background-color: var(--brand-orange);
    border-color: var(--brand-orange);
    color: white;
}

.main-nav .btn-secondary.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: white;
    color: white;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.tire-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: .5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeIn 0.5s ease forwards;
    position: relative;
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.card-actions {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.tire-card:hover .card-actions {
    opacity: 1;
}

.exact-match {
    border-left: 4px solid #107C10;
    background-color: #F1FAF1;
}

.toast {
    transition: transform 0.4s ease, opacity 0.4s ease;
    transform: translateY(-120%);
    opacity: 0;
    background-color: var(--text-dark);
    color: var(--background-color);
    border-radius: 0.5rem;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Modal Styles */
.modal-tab {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
}

.modal-tab.active {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom-color: var(--primary-color);
}

.data-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: #F8F8F8;
}

#rim-filter-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23605E5C%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right .7em top 50%;
    background-size: .65em auto;
}

/* Audit Styles */
.audit-summary-section {
    margin-bottom: 1.5rem;
}

.audit-summary-section h4 {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.audit-summary-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 0.5rem;
    align-items: center;
}

.new-item-row {
    grid-template-columns: 2.5fr 1fr 1.5fr;
    align-items: center;
    padding: 0.5rem;
}

.audit-summary-row.shortage {
    background-color: rgba(220, 59, 11, 0.05);
}

.audit-summary-row.surplus {
    background-color: rgba(16, 124, 16, 0.05);
}

.variance-cell {
    font-weight: 700;
}

.variance-cell.shortage {
    color: #DC3B0B;
}

.variance-cell.surplus {
    color: #107C10;
}

.audit-edit-qty {
    width: 100%;
    text-align: center;
    padding: .25rem;
    border-radius: .25rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-background);
}

.audit-history-list-item {
    padding: 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background-color: var(--card-background);
}

.audit-history-list-item:hover {
    background-color: #f0f0f0;
}

.audit-history-list-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-hover);
}

.audit-history-list-item.active .text-gray-500 {
    color: rgba(255, 255, 255, 0.8);
}

/* Toggle Switch Styles */
.toggle-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

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

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

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

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

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.data-grid-header,
.batch-grid-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 50px;
    gap: 1rem;
    align-items: center;
    padding: 0 0.5rem;
}

.distributor-btn {
    background-color: #F5F5F5;
    border: 1px solid #C8C6C4;
    color: var(--text-dark);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.distributor-btn:hover {
    background-color: #E1E1E1;
}

.analytics-section {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out, margin 0.5s ease-in-out;
}

.analytics-section.open {
    max-height: 1000px;
    padding: 1.5rem;
    margin-top: 0.5rem;
}

/* Direct Quantity Edit Styles */
.stock-quantity-wrapper {
    cursor: pointer;
    position: relative;
}

.quantity-edit-input {
    width: 60px;
    text-align: center;
    padding: 2px;
    border-radius: 4px;
    border: 1px solid var(--primary-color);
    background-color: white;
    color: var(--text-dark);
}

/* Modern Tire Condition Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    transition: all 0.2s ease;
}

.badge-new {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.badge-used {
    background-color: #F1F5F9;
    color: var(--text-light);
    border: 1px solid #CBD5E1;
}

#catalog-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 1.25rem;
    padding: 0.5rem 0.25rem 1.5rem 0.25rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

#catalog-list::-webkit-scrollbar {
    height: 6px;
}

#catalog-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#catalog-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#catalog-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Catalog Navigation Wrapper */
.catalog-nav-wrapper {
    position: relative;
    width: 100%;
}

.catalog-scroll-btn {
    position: absolute;
    top: calc(50% - 20px);
    transform: translateY(-50%);
    z-index: 30;
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    color: #475569;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.catalog-nav-wrapper:hover .catalog-scroll-btn {
    opacity: 1;
}

.catalog-scroll-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-50%) scale(1.15);
}

.catalog-scroll-btn.prev {
    left: -22px;
}

.catalog-scroll-btn.next {
    right: -22px;
}

.catalog-card-vertical {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 300px;
    min-width: 300px;
    height: 100%;
    min-height: 440px;
    scroll-snap-align: start;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.catalog-card-vertical:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-6px);
    border-color: var(--primary-color);
}

.catalog-card-vertical .image-area {
    width: 100%;
    height: 200px;
    position: relative;
    background: #f8fafc;
    overflow: hidden;
}

.catalog-card-vertical .image-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.catalog-card-vertical:hover .image-area img {
    transform: scale(1.08);
}

.catalog-card-vertical .info-area {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.catalog-card-vertical .brand-label {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.catalog-card-vertical .model-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.catalog-card-vertical .stock-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 900;
    color: #059669;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    z-index: 10;
    border: 1px solid rgba(5, 150, 105, 0.1);
}

.catalog-card-vertical .stock-badge.low {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fee2e2;
}

.catalog-card-vertical .utqg-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.catalog-card-vertical .load-speed {
    color: var(--primary-color);
    font-weight: 900;
}

.catalog-card-vertical .spec-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.catalog-card-vertical .spec-badge {
    font-size: 0.7rem;
    background: #f1f5f9;
    color: #475569;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    border: 1px solid #e2e8f0;
}

.catalog-card-vertical .price-area {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.catalog-card-vertical .price-tag {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

.catalog-card-vertical .actions-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

@media (max-width: 640px) {
    .catalog-card-vertical {
        width: 260px;
        min-width: 260px;
    }
}