/* ====== Baohanh Warranty Lookup — Main Styles ====== */
/* Dynamic CSS variables injected via PHP in index.php */

/* ====== RESET ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg, #f5f5f5);
    color: var(--text, #1a1a2e);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ====== HEADER ====== */
.page-header {
    background: #f8f8f8;
    padding: 16px 0;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.page-header img {
    height: 44px;
    margin-bottom: 6px;
}

.page-header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.3px;
}

.page-header .subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ====== CONTAINER ====== */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

/* ====== LOGIN CARD ====== */
.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.login-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafbfc;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
    background: white;
}

.btn-lookup {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-lookup:hover {
    background: var(--primary-light);
}

.btn-lookup:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ====== LOADING & ERROR ====== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    display: none;
}

.loading.active {
    display: block;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 14px;
    display: none;
}

.error-msg.active {
    display: block;
}

/* ====== CONFIG ERROR ====== */
.config-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.config-error h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--danger);
}

.config-error p {
    font-size: 0.85rem;
}

/* ====== RESULTS ====== */
#result {
    display: none;
}

#result.active {
    display: block;
}

.customer-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.customer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.customer-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.member-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f3f4f6;
    color: var(--text-muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.customer-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    font-size: 0.85rem;
}

.customer-details .label {
    color: var(--text-muted);
    white-space: nowrap;
}

.customer-details .value {
    font-weight: 500;
}

/* ====== TABS ====== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    gap: 0;
}

.tab-btn {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ====== ORDER CARD ====== */
.order-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
}

.order-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
}

.order-code {
    font-weight: 700;
    font-size: 0.92rem;
}

.order-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.product-row {
    padding: 12px 16px;
    border-bottom: 1px solid #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.product-row:last-child {
    border-bottom: none;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.35;
}

.product-meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.warranty-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.warranty-badge.active {
    background: #dcfce7;
    color: #166534;
}

.warranty-badge.expired {
    background: #fef2f2;
    color: #991b1b;
}

.warranty-badge.none {
    background: #f3f4f6;
    color: #9ca3af;
}

.order-total {
    padding: 10px 16px;
    text-align: right;
    font-size: 0.85rem;
    background: #fafbfc;
    border-top: 1px solid var(--border);
}

.order-total strong {
    color: var(--primary);
}

/* ====== HISTORY GRID ====== */
.history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.history-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 14px;
    box-shadow: var(--shadow);
}

.history-pname {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.history-detail span {
    color: var(--text);
    font-weight: 500;
    float: right;
}

/* ====== BACK BUTTON ====== */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 12px;
    transition: all 0.15s;
}

.btn-back:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ====== FOOTER ====== */
.page-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.page-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 400px) {
    .history-grid {
        grid-template-columns: 1fr;
    }
    .customer-details {
        font-size: 0.82rem;
    }
}
