@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #1a56db;
    --primary-hover: #1e429f;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Header */
.header {
    background: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4f46e5, #9333ea);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--text-muted);
}

/* Page Container */
.page {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.section-title {
    font-size: 28px;
    margin-bottom: 20px;
}

/* Search Bar */
.search-container {
    position: relative;
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: white;
    font-size: 16px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Product Cards */
.product-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    width: 100%;
    height: 180px;
    background-color: #fce7f3;
    /* Pinkish as placeholder */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-content {
    padding: 20px;
}

.product-title {
    font-size: 18px;
    margin-bottom: 8px;
}

.product-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-outline {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    background: rgba(26, 86, 219, 0.05);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: var(--transition);
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 20px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.detail-image {
    width: 100%;
    height: 200px;
    background: #eff6ff;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.detail-text {
    font-size: 15px;
    color: #4b5563;
    margin-bottom: 20px;
    white-space: pre-line;
}

.modal-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    border: none;
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(26, 86, 219, 0.3);
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

/* Registration Popup (Center) */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 2000;
    display: none;
    /* Controlled by JS */
}

.popup-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    animation: popupIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes popupIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-title {
    font-size: 18px;
    margin-bottom: 24px;
    color: #111827;
}

.popup-actions {
    display: flex;
    gap: 12px;
}

.btn-confirm {
    flex: 1;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

.btn-back {
    flex: 1;
    padding: 12px;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

/* Utils */
.hidden {
    display: none !important;
}

/* PIN Screen Styles */
#pin-screen {
    position: fixed;
    top: 64px;
    /* Below header */
    left: 0;
    width: 100%;
    height: calc(100% - 64px);
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 50;
}

.pin-container {
    background: white;
    padding: 30px 20px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow);
}

.pin-title {
    font-size: 20px;
    margin-bottom: 30px;
    color: #111827;
}

.pin-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.pin-inputs input {
    width: 45px;
    height: 45px;
    text-align: center;
    font-size: 24px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    transition: var(--transition);
}

.pin-inputs input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.pin-inputs input.error {
    border-color: #ef4444;
    color: #ef4444;
}

.error-text {
    color: #ef4444;
    font-size: 14px;
    margin-top: 10px;
}

#main-app.hidden {
    display: none;
}

.back-nav-btn:active {
    transform: scale(0.9);
}