/* Plate Specific Styles */
.search-box {
    background: rgba(var(--secondary-bg-rgb), 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 3rem;
    overflow: hidden;
    /* Prevent internal spill */
    max-width: 100%;
    box-sizing: border-box;
}

.search-box h2 {
    font-size: 1.8rem;
    word-wrap: break-word;
}

/* Filter Grid Responsive */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(var(--primary-bg-rgb), 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.2);
}

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

.plate-item {
    /* Background handled inline by PHP now */
    border: 2px solid #000;
    border-radius: 12px;
    /* Slightly more square like license plates */
    padding: 1rem;
    position: relative;
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 160px;
    /* Increased height slightly for the larger price */
    /* Fixed height for consistency */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    /* Fallback */
}

.plate-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    z-index: 10;
    border-color: var(--accent-color);
}

.plate-number {
    font-family: 'Sarabun', sans-serif;
    font-size: 2.8rem;
    line-height: 1;
    font-weight: 700;
    margin: 0;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.plate-province {
    font-size: 1rem;
    margin-bottom: 2rem;
    /* Space for price */
    white-space: nowrap;
    font-weight: 500;
}

.plate-price-large {
    position: absolute;
    bottom: 12px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    z-index: 5;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.plate-sum {
    position: absolute;
    top: 8px !important;
    right: 8px !important;
    width: 30px;
    height: 30px;
    background: #3b82f6 !important;
    /* Blue like image */
    color: white !important;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
    line-height: 1;
}

.plate-status {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.plate-actions {
    position: absolute;
    bottom: -50px;
    /* Hide by default */
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: grid;
    grid-template-columns: 1fr 1fr;
    transition: bottom 0.3s;
}

.plate-item:hover .plate-actions {
    bottom: 0;
}

.btn-small {
    padding: 0.5rem;
    font-size: 0.8rem;
    border-radius: 0;
}

@media (max-width: 600px) {
    .search-box {
        padding: 1rem;
    }

    .search-box h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem !important;
        /* Force tighter spacing */
    }

    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 cols on mobile for compactness */
        gap: 0.5rem;
    }

    .plate-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        /* Ensure it behaves within container */
    }

    .plate-item {
        height: auto;
        min-height: 110px;
        padding: 0.5rem;
    }

    .plate-number {
        font-size: 1.6rem;
    }

    .plate-province {
        font-size: 0.75rem;
    }
}

/* Modern Pagination - UI/UX Pro Max */
.pagination-wrapper {
    margin-top: 2.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

.pagination-container {
    display: flex;
    align-items: center;
    gap: 6px;
    /* Compact spacing */
    padding: 6px;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    scrollbar-width: none;
    /* Firefox */
}

/* Hide scrollbar */
.pagination-container::-webkit-scrollbar {
    display: none;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    /* Fixed size */
    height: 38px;
    min-width: 38px;
    /* Prevent shrinking */
    border-radius: 50%;
    /* Circle */
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    /* Subtle backdrop */
}

.pagination-link:hover {
    color: var(--accent-color, #d4af37);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.1);
}

.pagination-link.active {
    background: var(--accent-color, #d4af37);
    color: #0f172a !important;
    /* Dark text for contrast */
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.pagination-link i {
    font-size: 0.8rem;
}

/* Mobile specific adjustment for even tighter fit */
@media (max-width: 480px) {
    .pagination-container {
        gap: 4px;
    }

    .pagination-link {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 0.85rem;
    }
}