/* Spare Part Price Checker Premium Styles */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;600;700;800&display=swap');

.price-check-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Kanit', sans-serif;
}

.price-check-container h2 {
    font-family: 'Kanit', sans-serif;
    background: linear-gradient(135deg, #8e44ad, #3498db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 12px rgba(142, 68, 173, 0.3);
    font-weight: 800;
}

.brand-tabs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 5px;
    margin-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.brand-tabs::-webkit-scrollbar {
    height: 8px;
}

.brand-tabs::-webkit-scrollbar-track {
    background: rgba(168, 85, 247, 0.1);
    border-radius: 10px;
}

.brand-tabs::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    border-radius: 10px;
}

.brand-tabs::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #9333ea, #4f46e5);
}

.brand-tabs-hint {
    text-align: center;
    font-size: 0.75rem;
    color: #a855f7;
    margin-bottom: 20px;
    opacity: 0.7;
    font-family: 'Kanit', sans-serif;
}

.brand-tab {
    padding: 12px 24px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 30px;
    color: #64748b;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 700;
    font-family: 'Kanit', sans-serif;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 2;
}

.brand-tab.active {
    background: linear-gradient(135deg, #a855f7, #6366f1) !important;
    border-color: rgba(168, 85, 247, 0.3) !important;
    color: white !important;
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.5) !important;
    transform: translateY(-3px) scale(1.05) !important;
}

.brand-tab:active {
    transform: scale(0.95);
}

.part-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.part-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), #a855f7);
    border-radius: 6px 0 0 6px;
}

.part-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 0 20px rgba(142, 68, 173, 0.1);
    border-color: rgba(142, 68, 173, 0.3);
}

.part-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 15px;
    margin: -24px -24px 15px -24px;
    background: linear-gradient(135deg, #f3e7ff 0%, #e0f2fe 100%);
    border-radius: 24px 24px 0 0;
    border-bottom: 2px solid rgba(168, 85, 247, 0.1);
}

.model-img {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    background: #f1f5f9;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid white;
}

.model-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.5px;
}

.brand-tag {
    font-size: 0.75rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(59, 130, 246, 0.1));
    color: #0891b2;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 700;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.part-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.part-section-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 5px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.grade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.grade-box {
    text-align: center;
    padding: 12px 8px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.grade-box:hover {
    background: white;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: rgba(142, 68, 173, 0.1);
}

.grade-label {
    font-size: 0.7rem;
    color: #64748b;
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.grade-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
}

/* Thumbnail Styling */
.price-thumbnail {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: #f1f5f9;
}

.price-thumbnail:hover {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 8px 15px rgba(142, 68, 173, 0.3);
    z-index: 10;
}

.thumbnail-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e0e7ff, #fce7f3);
    border: 2px dashed rgba(168, 85, 247, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0.6;
    transition: all 0.3s;
}

.thumbnail-placeholder:hover {
    opacity: 0.9;
    transform: scale(1.1);
}


.other-parts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-edit-part {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
    z-index: 10;
}

.btn-edit-part::after {
    content: 'แก้ไข';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: #a855f7;
    white-space: nowrap;
    font-family: 'Kanit', sans-serif;
    opacity: 0.8;
}

.btn-edit-part:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 25px rgba(168, 85, 247, 0.6);
}

.btn-edit-part:active {
    transform: scale(0.95);
}

/* Delete Button */
.btn-delete-part {
    position: absolute;
    top: 15px;
    right: 65px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    z-index: 10;
}

.btn-delete-part::after {
    content: 'ลบ';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: #ef4444;
    white-space: nowrap;
    font-family: 'Kanit', sans-serif;
    opacity: 0.8;
}

.btn-delete-part:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.6);
}

.btn-delete-part:active {
    transform: scale(0.95);
}


.btn-view-img {
    background: linear-gradient(135deg, #f3e8ff, #ede9fe);
    border: 1px solid rgba(168, 85, 247, 0.2);
    color: #7e22ce;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-view-img:hover {
    background: linear-gradient(135deg, #a855f7, #7e22ce);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(168, 85, 247, 0.3);
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-overlay[style*="display: flex"] {
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lightbox-overlay.active .lightbox-content {
    transform: scale(1);
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-user-select: none;
    border: 4px solid white;
}

.zoom-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: 'Kanit', sans-serif;
    pointer-events: none;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.btn-close-lightbox {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff3f34;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 63, 52, 0.4);
    z-index: 10001;
    transition: all 0.3s;
}

.btn-close-lightbox:hover {
    transform: scale(1.1) rotate(90deg);
    background: #ff5e57;
}

/* Shine Effect Animation */
.part-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transform: skewX(-25deg);
    transition: 0.7s;
    pointer-events: none;
}

.part-card:hover::after {
    left: 150%;
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0px);
    }
}

.model-img {
    animation: float 4s ease-in-out infinite;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Edit Modal Layout Improvements */
.edit-modal-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 5px;
}

.edit-modal-content::-webkit-scrollbar {
    width: 6px;
}

.edit-modal-content::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.form-section-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
    margin: 15px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid rgba(142, 68, 173, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 600px) {

    .form-grid,
    .form-grid-3 {
        grid-template-columns: 1fr 1fr;
        /* 2 columns on mobile instead of 3 */
    }

    .spare-parts-grid {
        grid-template-columns: 1fr;
    }

    .price-check-container {
        padding: 10px;
    }
}

.sync-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sync-btn {
    background: linear-gradient(135deg, #a55eea, #778ca3);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.sync-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(165, 94, 234, 0.4);
}

.sync-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}