/* ============================================
   Invoice Lookup - Clean Professional Design
   Inspired by VNBill
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --text-light: #94a3b8;
    --bg-light: #f1f5f9;
    --bg-gradient: linear-gradient(180deg, #e0f2fe 0%, #f1f5f9 100%);
    --white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s ease;
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: var(--white);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-dark);
}

.logo i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    font-size: 1.4rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo strong {
    color: var(--primary-color);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.logo-text span {
    font-size: 1.35rem;
    font-weight: 600;
    color: #374151;
}

.logo-text small {
    font-size: 0.75rem;
    font-weight: 400;
    color: #6b7280;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 10px 18px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.nav-link.active {
    color: var(--primary-color);
}

.mobile-menu-btn {
    display: none;
    padding: 10px;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-dark);
    cursor: pointer;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    background: var(--bg-gradient);
    padding: 60px 0 80px;
    position: relative;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-breadcrumb {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

/* ============================================
   SEARCH BOX
   ============================================ */
.search-box {
    display: flex;
    max-width: 700px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.15);
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.search-box:focus-within {
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.25);
    transform: translateY(-2px);
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 24px;
    color: var(--text-light);
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    padding: 18px 24px 18px 56px;
    border: none;
    font-size: 1.05rem;
    font-family: inherit;
    color: var(--text-dark);
    outline: none;
    background: transparent;
    border-radius: 50px 0 0 50px;
}

.search-input::placeholder {
    color: var(--text-light);
    transition: color 0.2s ease;
}

.search-input:focus::placeholder {
    color: #cbd5e1;
}

.btn-search {
    padding: 18px 36px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: var(--white);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0 50px 50px 0;
    min-width: 140px;
}

.btn-search:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-search:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-search:disabled {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 16px;
    right: 16px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 320px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 100;
}

.search-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-loading {
    padding: 30px;
    text-align: center;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.dropdown-item {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.highlighted {
    background: var(--primary-light);
}

.dropdown-item .code {
    background: var(--primary-color);
    color: var(--white);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.dropdown-item .name {
    color: var(--text-dark);
    font-size: 0.95rem;
}

.dropdown-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-gray);
}

/* Selected Tag */
.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding: 10px 16px;
    background: var(--white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
}

.tag-code {
    background: var(--success-color);
    color: var(--white);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.tag-name {
    color: var(--text-dark);
    font-weight: 500;
}

.tag-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: none;
    border-radius: 50%;
    color: var(--text-gray);
    cursor: pointer;
    transition: var(--transition);
}

.tag-remove:hover {
    background: var(--error-color);
    color: var(--white);
}

/* ============================================
   STEPS SECTION
   ============================================ */
.steps-section {
    padding: 60px 0;
    background: var(--white);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 30px;
}

.step-card {
    text-align: center;
    padding: 20px;
}

.step-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary-color);
    position: relative;
}

.step-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    background: var(--success-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--white);
}

.step-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.step-card p {
    color: var(--text-gray);
    font-size: 0.9rem;
    line-height: 1.6;
}

.steps-title {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ============================================
   RESULT SECTION
   ============================================ */
.result-section {
    padding: 40px 0 60px;
}

.result-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px;
}

.result-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    font-size: 1rem;
}

.result-loading i {
    font-size: 2rem;
    color: var(--primary-color);
}

.result-error {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--error-color);
}

.result-error h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.result-error p {
    color: var(--text-gray);
}

/* Success State */
.result-header {
    margin-bottom: 30px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--text-gray);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb i {
    font-size: 0.7rem;
    color: var(--text-light);
}

.breadcrumb span {
    color: var(--text-dark);
}

.result-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.invoice-preview {
    margin-bottom: 30px;
}

.invoice-info-card {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 30px;
    border: 1px solid var(--border-color);
}

.invoice-header-info {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.invoice-logo {
    width: 70px;
    height: 70px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.invoice-meta h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.invoice-meta p {
    margin-bottom: 8px;
    color: var(--text-gray);
    font-size: 0.95rem;
}

.invoice-meta strong {
    color: var(--text-dark);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success-color);
    font-weight: 500;
}

.invoice-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--text-light);
}

/* ============================================
   STATS SECTION
   ============================================ */
.stats-section {
    padding: 40px 0;
    background: var(--white);
    border-top: 1px solid var(--border-color);
}

.stats-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.stat-divider {
    width: 1px;
    height: 50px;
    background: var(--border-color);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: #1e293b;
    padding: 30px 0;
    color: var(--white);
}

.footer-content {
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--white);
}

.footer-copyright {
    color: #64748b;
    font-size: 0.85rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .header-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero {
        padding: 40px 0 60px;
    }

    .search-box {
        flex-direction: column;
        border-radius: var(--radius-md);
    }

    .search-input {
        padding: 18px 20px 18px 50px;
    }

    .search-icon {
        left: 20px;
    }

    .btn-search {
        padding: 16px;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .result-card {
        padding: 24px;
    }

    .invoice-header-info {
        flex-direction: column;
        text-align: center;
    }

    .invoice-logo {
        margin: 0 auto;
    }

    .invoice-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        flex-direction: column;
        gap: 30px;
    }

    .stat-divider {
        width: 80px;
        height: 1px;
    }

    .footer-links {
        flex-direction: column;
        gap: 12px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-gray);
}

/* ============================================
   PDF VIEWER MODAL
   ============================================ */
.pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

.pdf-modal.show {
    display: block;
}

.pdf-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.pdf-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.pdf-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.pdf-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.pdf-modal-body {
    flex: 1;
    background: #f3f4f6;
    padding: 0;
}

.pdf-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive modal */
@media (max-width: 768px) {
    .pdf-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .pdf-modal-header {
        padding: 12px 16px;
    }
}