/**
 * SEARCH HISTORY — Premium iOS Style
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   FONTS
   ═══════════════════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Raavi';
    src: local('Raavi'), local('Raavi Regular');
    font-display: swap;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   THEME
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    --bg: var(--bg-primary);
    --bg-card: var(--bg-secondary);
    --text: var(--text-primary);
    --text-secondary: var(--text-secondary);
    --text-tertiary: var(--text-secondary);
    --accent: var(--text-accent);
    --accent-light: rgba(0, 122, 255, 0.1);
    --red: #ff3b30;
    --red-light: rgba(255, 59, 48, 0.1);
    --border: var(--border-color);
    --nav-bg: var(--bg-secondary);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --font-gurmukhi: 'Raavi', 'Noto Sans Gurmukhi', 'Mukta Mahee', sans-serif;

    --orb-1: rgba(255, 180, 100, 0.2);
    --orb-2: rgba(150, 200, 255, 0.18);
    --orb-3: rgba(255, 150, 180, 0.15);
}

[data-theme="dark"] {
    --accent-light: rgba(10, 132, 255, 0.15);
    --red-light: rgba(255, 69, 58, 0.15);
    --orb-1: rgba(100, 80, 200, 0.25);
    --orb-2: rgba(50, 150, 200, 0.2);
    --orb-3: rgba(200, 80, 150, 0.15);
}

[data-theme="divineGold"] {
    --accent-light: rgba(184, 134, 11, 0.15);
    --orb-1: rgba(218, 165, 32, 0.2);
    --orb-2: rgba(244, 220, 170, 0.15);
    --orb-3: rgba(230, 190, 120, 0.12);
}

[data-theme="sepia"] {
    --accent-light: rgba(139, 105, 20, 0.12);
    --orb-1: rgba(220, 180, 140, 0.2);
    --orb-2: rgba(200, 160, 120, 0.15);
    --orb-3: rgba(230, 200, 170, 0.12);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════════ */

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

.no-transitions,
.no-transitions *,
.no-transitions *::before,
.no-transitions *::after {
    transition: none !important;
    animation-duration: 0s !important;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100% !important;
    font-size: 16px !important;
    touch-action: manipulation;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ORBS
   ═══════════════════════════════════════════════════════════════════════════════ */

.orbs-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.7;
    animation: orbFloat 22s ease-in-out infinite;
    will-change: transform;
}

.orb-1 {
    width: 320px;
    height: 320px;
    background: var(--orb-1);
    top: -8%;
    left: -8%;
    animation-duration: 25s;
}

.orb-2 {
    width: 280px;
    height: 280px;
    background: var(--orb-2);
    top: 40%;
    right: -12%;
    animation-delay: -6s;
    animation-duration: 20s;
}

.orb-3 {
    width: 240px;
    height: 240px;
    background: var(--orb-3);
    bottom: 5%;
    left: 15%;
    animation-delay: -12s;
    animation-duration: 28s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(25px, -35px) scale(1.04); }
    66% { transform: translate(-20px, 20px) scale(0.96); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════════ */

.ios-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(56px + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--nav-bg);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-bottom: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 8px;
    padding-right: 16px;
}

.nav-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
}

.nav-back:active {
    opacity: 0.5;
}

.nav-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.3px;
}

.nav-actions {
    display: flex;
    align-items: center;
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--red);
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    padding: 8px 4px;
}

.clear-all-btn:active {
    opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════════ */

.main-content {
    position: relative;
    z-index: 2;
    padding-top: calc(56px + var(--safe-top) + 12px);
    padding-bottom: calc(var(--safe-bottom) + 40px);
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

.history-section {
    margin-bottom: 8px;
    animation: sectionIn 0.4s ease backwards;
}

@keyframes sectionIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 16px 20px 8px;
}

.section-list {
    background: var(--bg-card);
    margin: 0 16px;
    border-radius: 14px;
    overflow: hidden;
}

[data-theme="dark"] .section-list {
    background: var(--bg-card);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   HISTORY ROW
   ═══════════════════════════════════════════════════════════════════════════════ */

.history-row {
    display: flex;
    align-items: center;
    position: relative;
    animation: rowIn 0.35s ease backwards;
    border-bottom: 0.5px solid var(--border);
}

.history-row:last-child {
    border-bottom: none;
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Delete animation */
.history-row.deleting {
    animation: rowOut 0.3s ease forwards;
}

@keyframes rowOut {
    to {
        opacity: 0;
        transform: translateX(60px);
        max-height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
}

.row-content {
    flex: 1;
    padding: 14px 0 14px 18px;
    cursor: pointer;
    min-width: 0;
}

.row-content:active {
    background: var(--accent-light);
}

.row-gurmukhi {
    font-family: var(--font-gurmukhi);
    font-size: 20px;
    line-height: 1.5;
    color: var(--text);
    font-weight: 400;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 400;
}

.row-source {
    color: var(--accent);
    font-weight: 500;
}

.row-dot {
    font-size: 10px;
    opacity: 0.4;
}

.row-results,
.row-time {
    color: var(--text-tertiary);
}

.row-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.15s, background 0.15s;
}

.row-delete:active {
    opacity: 1;
    color: var(--red);
    background: var(--red-light);
}

.row-chevron {
    font-size: 20px;
    font-weight: 300;
    color: var(--text-tertiary);
    opacity: 0.4;
    padding-right: 14px;
    flex-shrink: 0;
    line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════════ */

.empty-state {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.empty-state.visible {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.empty-icon {
    margin-bottom: 20px;
    color: var(--text-tertiary);
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CONFIRM SHEET
   ═══════════════════════════════════════════════════════════════════════════════ */

.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
}

.confirm-overlay.active {
    display: block;
}

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease;
}

.confirm-sheet {
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    bottom: calc(16px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 1px;
    animation: sheetUp 0.35s cubic-bezier(0.32, 0.72, 0, 1) backwards;
}

@keyframes sheetUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.confirm-text {
    text-align: center;
    padding: 18px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: 14px 14px 0 0;
}

.confirm-btn {
    width: 100%;
    padding: 17px;
    font-size: 20px;
    font-weight: 400;
    border: none;
    cursor: pointer;
    background: var(--bg-card);
}

.confirm-delete {
    color: var(--red) !important;
    font-weight: 600;
    border-radius: 0 0 20px 20px !important;
}

.confirm-cancel {
    color: var(--accent) !important;
    font-weight: 600;
    border-radius: 20px !important;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
}

[data-theme="dark"] .confirm-cancel {
    background: rgba(36, 36, 40, 0.9) !important;
}

.confirm-btn:active {
    opacity: 0.6;
}

.confirm-backdrop {
    background: rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}

.confirm-text {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    color: var(--text) !important;
    border-radius: 20px 20px 0 0 !important;
}

.confirm-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .confirm-text,
[data-theme="dark"] .confirm-btn {
    background: rgba(28, 28, 30, 0.85) !important;
    color: #ffffff !important;
}

.section-list {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 20px !important;
    margin: 0 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden;
}

[data-theme="dark"] .section-list {
    background: rgba(24, 24, 26, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════════ */
   
.toast {
    position: fixed;
    bottom: calc(40px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 12px 24px;
    background: var(--text);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    color: var(--bg);
    z-index: 600;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
