:root {
    --primary: #3A3A3A;
    --primary-light: #5A5A5A;
    --accent: #5A5A5A;
    --accent-dark: #3A3A3A;
    --accent-light: #7A7A7A;
    --success: #2D5016;
    --highlight-note: #4a6352;
    --bg-main: #F5F1EA;
    --bg-card: #FDFCFA;
    --text-primary: #1A1A1A;
    --text-secondary: #5C5C5C;
    --border: #D4C9B8;
    --shadow: 0 2px 8px rgba(58, 58, 58, 0.12);
    --shadow-lg: 0 8px 24px rgba(58, 58, 58, 0.18);
    --shadow-hover: 0 12px 32px rgba(58, 58, 58, 0.25);
    --similar-bg: #4a6352;
    --similar-border: #3d5244;
    --similar-text: #FFFFFF;
    --similar-label: #4a6352;
    --additional-bg: #7A5347;
    --additional-border: #64433A;
    --additional-text: #FFFFFF;
    --additional-label: #7A5347;
    --btn-random-text: #FFFFFF;
}

:root[data-theme="dark"] {
    --primary: #E5E7EB;
    --primary-light: #D1D5DB;
    --accent: #D1D5DB;
    --accent-dark: #9CA3AF;
    --accent-light: #E5E7EB;
    --success: #10B981;
    --bg-main: #0F0F0F;
    --bg-card: #1A1A1A;
    --text-primary: #E8E8E8;
    --text-secondary: #9CA3AF;
    --border: #3F3F3F;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.7);
    --similar-bg: #2F6B6B;
    --similar-border: #1F5555;
    --similar-text: #E8E8E8;
    --similar-label: #4A9999;
    --additional-bg: #5A2E3A;
    --additional-border: #44232D;
    --additional-text: #E8E8E8;
    --additional-label: #8A4D65;
    --btn-random-text: #1A1A1A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 400;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    position: relative;
}

.header-top {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.btn-theme-toggle {
    width: 48px;
    height: 48px;
    border: 2px solid var(--primary);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border-radius: 12px;
}

.btn-theme-toggle:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-theme-toggle:hover .theme-icon {
    transform: rotate(20deg);
}

.btn-theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    font-size: inherit;
    line-height: 1;
    width: 1em;
    height: 1em;
}

header h1 {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 200;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Search Section */
.search-section {
    background: var(--bg-card);
    padding: 3.5rem;
    border: 1px solid var(--border);
    margin-bottom: 3rem;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.search-container {
    position: relative;
}

.search-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 2.5rem;
    justify-content: center;
    background: var(--bg-main);
    border: 1px solid var(--border);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.mode-btn {
    padding: 1rem 2.5rem;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
}

.mode-btn:last-child {
    border-right: none;
}

.mode-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--accent);
    color: var(--bg-card);
    font-weight: 600;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Advanced Search */
.advanced-search {
    margin-bottom: 2rem;
}

.btn-advanced-toggle {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.25s ease;
    border-radius: 12px;
}

.btn-advanced-toggle:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.advanced-options {
    margin-top: 1rem;
    padding: 2rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
}

.advanced-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.advanced-row:last-child {
    margin-bottom: 0;
}

.advanced-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.advanced-field.full-width {
    grid-column: 1 / -1;
}

.advanced-field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.advanced-input {
    padding: 0.875rem 1.125rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.25s ease;
    border-radius: 10px;
    font-weight: 400;
}

.advanced-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(58, 58, 58, 0.08);
}

.advanced-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
    font-weight: 400;
}

.advanced-field small {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.advanced-checkbox {
    margin-right: 0.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .advanced-row {
        grid-template-columns: 1fr;
    }
}

.search-box {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border: 2px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#searchInput {
    flex: 1;
    padding: 1.5rem 2rem;
    border: none;
    font-size: 1.0625rem;
    background: var(--bg-card);
    letter-spacing: 0.01em;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-weight: 400;
}

#searchInput:focus {
    outline: none;
}

#searchInput::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
    font-weight: 400;
}

.btn-primary {
    padding: 1.5rem 3.5rem;
    background: var(--accent);
    color: var(--bg-card);
    border: none;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 160px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Autocomplete Dropdown */
#autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
}

.autocomplete-item {
    padding: 0.875rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.autocomplete-item:hover strong {
    color: var(--accent-dark);
}

.autocomplete-item strong {
    color: var(--text-primary);
}

.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding-top: 0.5rem;
}

.quick-suggestions .label {
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-right: 0.5rem;
}

.tag {
    padding: 0.625rem 1.25rem;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
    font-weight: 500;
    color: var(--accent-dark);
    border-radius: 20px;
}

.tag:hover {
    background: var(--accent);
    color: var(--bg-card);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Quick Actions */
.quick-actions {
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-random {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    border: none;
    color: var(--btn-random-text);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-random:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-random:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-random .icon {
    font-size: 1.25rem;
    animation: rotate-dice 3s ease-in-out infinite;
}

@keyframes rotate-dice {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
}

.btn-random:hover .icon {
    animation: rotate-dice 0.5s ease-in-out infinite;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Results Section */
.results-section {
    min-height: 400px;
}

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-message h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.welcome-message p {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Results Section */
.searched-perfume-section {
    margin-bottom: 2rem;
}

.section-title {
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.05em;
}

.search-icon {
    font-size: 1.5rem;
}

.searched-perfume-card {
    margin-bottom: 1.5rem;
}

.searched-banner {
    display: flex;
    gap: 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-radius: 16px;
}

.searched-image {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
}

.searched-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.searched-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.searched-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.searched-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.searched-brand {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.searched-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.searched-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.searched-accords,
.searched-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.searched-accords .accord {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
}

.searched-notes .note {
    font-size: 0.8rem;
    padding: 0.3rem 0.65rem;
}

.no-match-section {
    padding: 3rem;
    text-align: center;
}

.no-match-card {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    border-radius: 16px;
}

.no-match-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-match-card h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.no-match-card p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.no-match-card .hint {
    font-size: 0.9rem;
    font-style: italic;
}

/* Random Discovery Header */
.random-discovery-header {
    margin-bottom: 2rem;
    text-align: center;
}

.random-discovery-header .section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.random-discovery-header .search-icon {
    font-size: 2rem;
    animation: rotate-dice 3s ease-in-out infinite;
}

.random-discovery-header .section-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* Fragrance Cards */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.fragrance-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fragrance-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.card-image-container {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
}

.card-image-container img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.no-image-placeholder {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.similarity-badge-corner {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent);
    color: var(--bg-card);
    padding: 0.75rem 1rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-align: center;
    border-radius: 12px;
}

.similarity-percent {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.similarity-text {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.shared-info {
    padding: 0.75rem 1.5rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
}

.shared-badge {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.fragrance-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.fragrance-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.fragrance-brand {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

.fragrance-description {
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    line-height: 1.6;
    font-size: 0.9rem;
}

.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.section-label-similar {
    color: var(--similar-label);
}

.section-label-additional {
    color: var(--additional-label);
}

.accords-section,
.notes-section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.accords-section:last-child,
.notes-section:last-child {
    border-bottom: none;
}

.accords-container,
.notes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.accord {
    padding: 0.4rem 0.9rem;
    background: var(--accent);
    color: var(--bg-card);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
}

.shared-accord {
    background: var(--accent);
    border: 2px solid var(--accent-dark);
    font-weight: 700;
    color: var(--bg-card);
}

.accord-similar {
    background: var(--similar-bg);
    border: 2px solid var(--similar-border);
    color: var(--similar-text);
    font-weight: 700;
}

.accord-additional {
    background: var(--additional-bg);
    border: 2px solid var(--additional-border);
    color: var(--additional-text);
    font-weight: 600;
}

.note {
    padding: 0.35rem 0.75rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.note:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #1A1A1A;
}

.shared-note {
    background: var(--accent);
    border-color: var(--accent);
    color: #1A1A1A;
    font-weight: 600;
}

.note-similar {
    background: var(--similar-bg);
    border: 2px solid var(--similar-border);
    color: var(--similar-text);
    font-weight: 600;
}

.note-additional {
    background: var(--additional-bg);
    border: 2px solid var(--additional-border);
    color: var(--additional-text);
    font-weight: 500;
}

/* Matched Fragrance Card */
.matched-fragrance {
    border: 2px solid var(--accent);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.match-label {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent);
    color: var(--bg-card);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-separator {
    margin: 2rem 0;
    text-align: center;
}

.results-separator h3 {
    color: var(--accent);
    font-weight: 400;
    letter-spacing: 0.05em;
}

.fragrance-meta {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.1);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Admin Section */
.admin-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px dashed var(--border);
}

.btn-toggle {
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.admin-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    margin-top: 1rem;
}

.admin-form h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem;
    border-top: 2px solid var(--border);
    text-align: center;
    background: var(--bg-card);
    transition: all 0.3s ease;
}

.service-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 2rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.status-indicator {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    background: var(--text-secondary);
    flex-shrink: 0;
}

.status-indicator.online {
    background: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.status-indicator.offline {
    background: #EF4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.1);
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.btn-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 2px solid var(--accent);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.pwa-icon {
    font-size: 2rem;
}

.pwa-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.pwa-text p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.pwa-banner-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pwa-btn-install {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: var(--bg-card);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-btn-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.pwa-btn-dismiss {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-btn-dismiss:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.pwa-update-notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--accent);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10001;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-btn-update {
    padding: 0.5rem 1rem;
    background: white;
    color: var(--accent);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets on mobile */
    .btn-primary,
    .btn-random,
    .mode-btn,
    .tag,
    .btn-icon {
        min-height: 44px;
        min-width: 44px;
    }
    
    .note,
    .accord {
        padding: 0.5rem 0.875rem;
    }
    
    /* Disable hover scaling on touch devices */
    .btn-icon:hover,
    .btn-theme-toggle:hover .theme-icon {
        transform: none;
    }
    
    /* Only use active state on touch */
    .btn-icon:active,
    .btn-theme-toggle:active {
        transform: scale(0.95);
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0.5rem;
        max-width: 100%;
    }
    
    header {
        padding: 0.75rem 0;
    }
    
    header h1 {
        font-size: 1.75rem;
        margin: 0.5rem 0;
    }
    
    .header-top {
        gap: 0.5rem;
        justify-content: center;
        margin-bottom: 0.75rem;
    }
    
    .btn-theme-toggle {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    
    .btn-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    
    /* Search mode toggle - stack on mobile */
    .search-mode-toggle {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mode-btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem;
        font-size: 0.9375rem;
    }
    
    /* Quick actions */
    .quick-actions {
        margin: 0.75rem 0;
    }
    
    .btn-random {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .btn-random .icon {
        font-size: 1.1rem;
    }
    
    /* Advanced options - stack fields */
    .advanced-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .advanced-field label {
        font-size: 0.75rem;
    }
    
    .advanced-input {
        font-size: 14px;
        padding: 0.625rem;
    }
    
    /* Search box */
    .search-box {
        flex-direction: column;
        gap: 0.625rem;
    }
    
    #searchInput {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }
    
    .btn-primary {
        width: 100%;
        padding: 0.875rem;
        font-size: 0.9375rem;
    }
    
    /* Welcome message */
    .welcome-message {
        padding: 2rem 1rem;
    }
    
    .welcome-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .welcome-message h2 {
        font-size: 1.5rem;
    }
    
    .welcome-message p {
        font-size: 0.9375rem;
    }
    
    /* Tags */
    .tag {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    /* Form row */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Results grid - single column */
    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Fragrance cards - optimize for mobile */
    .fragrance-card {
        padding: 1rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .card-title {
        font-size: 1.125rem;
    }
    
    .card-brand {
        font-size: 0.875rem;
    }
    
    .similarity-badge {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .card-image {
        width: 80px;
        height: 80px;
    }
    
    /* Searched perfume banner */
    .searched-banner {
        flex-direction: column;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .searched-image {
        width: 80px;
        height: 80px;
    }
    
    .searched-name {
        font-size: 1.25rem;
    }
    
    .searched-brand {
        font-size: 0.875rem;
    }
    
    /* Notes and accords */
    .note,
    .accord {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
    }
    
    /* Modal title size for mobile */
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.75rem;
    }
    
    /* Tab buttons - horizontal scroll on mobile */
    .glossary-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0.5rem;
    }
    
    .glossary-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        flex-shrink: 0;
        min-width: 100px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Mode cards in help modal */
    .mode-card {
        padding: 1rem;
    }
    
    .mode-card h3 {
        font-size: 1rem;
    }
    
    .mode-card p {
        font-size: 0.875rem;
    }
    
    /* Accord grid - 2 columns on mobile */
    .accord-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }
    
    .accord-card {
        padding: 0.75rem;
    }
    
    .accord-card h4 {
        font-size: 0.875rem;
    }
    
    .accord-card p {
        font-size: 0.75rem;
    }
    
    /* Stats section */
    .stats-section {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 1rem 0.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Recent searches */
    .recent-searches {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .recent-title {
        font-size: 0.875rem;
    }
    
    .recent-list {
        gap: 0.375rem;
    }
    
    .recent-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    /* PWA install banner - stack on very small screens */
    .pwa-install-banner {
        flex-direction: column;
        text-align: center;
        padding: 0.875rem;
    }
    
    .pwa-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .pwa-text strong {
        font-size: 0.9375rem;
    }
    
    .pwa-text p {
        font-size: 0.8125rem;
    }
    
    .pwa-btn-install {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}
    /* Recent searches */
    .recent-searches {
        padding: 1rem;
    }
    
    .recent-list {
        gap: 0.5rem;
    }
    
    /* PWA install banner - stack on very small screens */
    .pwa-install-banner {
        flex-direction: column;
        text-align: center;
    }
    
    .pwa-banner-content {
        flex-direction: column;
        text-align: center;
    }


/* Recent Searches */
.recent-searches {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-main);
    border: 2px solid var(--accent);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    border-radius: 12px;
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.recent-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.btn-clear-history {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    border-radius: 6px;
}

.btn-clear-history:hover {
    background: var(--accent);
    color: #1A1A1A;
    border-color: var(--accent);
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recent-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-radius: 20px;
}

.recent-item:hover {
    background: var(--accent);
    color: #1A1A1A;
    font-weight: 600;
}

.recent-mode-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    background: var(--accent);
    color: var(--bg-card);
    border-radius: 4px;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.recent-query {
    font-weight: 500;
    flex: 1;
    text-align: left;
}

/* Card Actions - Find Similar Button */
.card-actions {
    padding: 1.5rem;
    margin-top: auto;
}

.btn-find-similar {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--accent);
    border: none;
    color: var(--bg-card);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-find-similar:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin: 3rem 0;
}

.btn-load-more {
    padding: 1rem 3rem;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
}

.btn-load-more:hover {
    background: var(--accent);
    color: #1A1A1A;
}

/* Icon Buttons */
.btn-icon {
    width: 48px;
    height: 48px;
    border: 2px solid var(--primary);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border-radius: 12px;
}

.btn-icon:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
}

.btn-icon:active {
    transform: scale(0.95);
}

.btn-icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: inherit;
    line-height: 1;
    width: 1em;
    height: 1em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-content.modal-large {
    max-width: 1000px;
}

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

.modal-header {
    padding: 2rem 2.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 300;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.modal-body {
    padding: 2.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Guide Section */
.guide-section {
    margin-bottom: 2.5rem;
}

.guide-section h3 {
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.info-card {
    background: var(--bg-main);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.info-card h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.info-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.info-card code {
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    display: inline-block;
    border: 1px solid var(--border);
}

.examples ul {
    list-style: none;
    padding: 0;
}

.examples li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.examples li:last-child {
    border-bottom: none;
}

.result-legend p {
    margin: 0.75rem 0;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8125rem;
    display: inline-block;
}

.badge-green {
    background: var(--highlight-note);
    color: var(--similar-text);
}

.badge-gray {
    background: var(--bg-main);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.tips-list li:last-child {
    border-bottom: none;
}

/* Glossary Tabs */
.glossary-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary);
    background: var(--bg-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Accord Grid */
.accord-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.accord-item {
    background: var(--bg-main);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.accord-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.accord-icon {
    font-size: 2rem;
}

.accord-item h4 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--primary);
}

.accord-desc {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-style: italic;
}

.accord-notes,
.accord-use {
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

/* Notes Grid */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.note-category h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.note-category ul {
    list-style: none;
    padding: 0;
}

.note-category li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.note-category li:last-child {
    border-bottom: none;
}

/* Terms List */
.terms-list {
    display: grid;
    gap: 2rem;
}

.term-item {
    background: var(--bg-main);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.term-item h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.term-item p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.term-item ul {
    margin-top: 0.75rem;
    padding-left: 1.5rem;
}

.term-item li {
    margin: 0.5rem 0;
}

/* About Section */
.about-section {
    margin-bottom: 2.5rem;
}

.about-section h3 {
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.about-section p {
    line-height: 1.8;
    margin: 0.75rem 0;
}

/* How It Works Steps */
.how-it-works {
    display: grid;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.step {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.step-content h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.step-content p {
    margin: 0;
    color: var(--text-secondary);
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature {
    text-align: center;
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.feature h4 {
    margin: 0.5rem 0;
    color: var(--primary);
    font-size: 1rem;
}

.feature p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Tech List */
.tech-list {
    list-style: none;
    padding: 0;
}

.tech-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.tech-list li:last-child {
    border-bottom: none;
}

/* External Link */
.link-external {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.link-external:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

/* Mobile Responsiveness for Modals */
@media (max-width: 768px) {
    .modal.active {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }
    
    .modal-content {
        max-height: 100%;
        height: 100%;
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 10;
        flex-shrink: 0;
    }
    
    .modal-body {
        padding: 1.5rem;
        overflow-y: auto;
        flex: 1;
    }
    
    .mode-cards,
    .accord-grid,
    .notes-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .glossary-tabs {
        overflow-x: auto;
    }
    
    .tab-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}