/* ==========================================
   EXILIUM — Medical Cannabis Strain Tracker
   Design System & Styles
   ========================================== */

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

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #06060b;
    --bg-secondary: rgba(13, 13, 20, 0.6);
    --bg-card: rgba(16, 16, 26, 0.4);
    --bg-card-hover: rgba(22, 22, 36, 0.55);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-input: rgba(255, 255, 255, 0.08);
    --bg-modal: rgba(6, 6, 11, 0.65);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.12);
    --border-input: rgba(255, 255, 255, 0.15);
    --border-focus: rgba(16, 185, 129, 0.5);

    --text-primary: #e8e8ed;
    --text-secondary: #8b8b9e;
    --text-muted: #55556a;
    --text-inverse: #06060b;

    --accent: #10b981;
    --accent-hover: #34d399;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --accent-subtle: rgba(16, 185, 129, 0.08);

    --indica: #8b5cf6;
    --sativa: #f59e0b;
    --hybrid: #10b981;

    --danger: #ef4444;
    --danger-hover: #f87171;

    --star: #f59e0b;
    --star-empty: #2a2a3d;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.1);

    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    /* Disable text selection */
    -webkit-user-select: none;
    /* Safari */
    -ms-user-select: none;
    /* IE 10 and IE 11 */
    user-select: none;
    /* Standard syntax */
}

/* Ambient background glow */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-card);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Layout --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* --- Header --- */
.header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(32px) saturate(150%);
    -webkit-backdrop-filter: blur(32px) saturate(150%);
    background: rgba(6, 6, 11, 0.4);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon-img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.3));
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.logo-text span {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #059669);
    color: var(--text-inverse);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-card);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-input);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

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

.btn-icon {
    padding: 10px;
    aspect-ratio: 1;
}

/* --- Stats Bar --- */
.stats-bar {
    display: flex;
    gap: 8px;
    padding: 20px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.stats-bar::-webkit-scrollbar {
    display: none;
}

.stat-card {
    flex: 1;
    min-width: 140px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.stat-card.accent .stat-value {
    color: var(--accent);
}

/* --- Controls Bar --- */
.controls-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 24px;
    flex-wrap: wrap;
}

.search-wrapper {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.search-wrapper svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.search-input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: all var(--transition-base);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.07);
}

.filter-select {
    padding: 11px 36px 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b8b9e' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 3.5L11.5 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.filter-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* --- Strain Grid --- */
.strain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding-bottom: 60px;
}

/* --- Strain Card --- */
.strain-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: transform var(--transition-slow), box-shadow var(--transition-slow), background var(--transition-base), border-color var(--transition-base);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.4s ease backwards;
}

.strain-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: 2;
}

.strain-card:hover {
    border-color: var(--border-input);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.strain-card:hover::before {
    opacity: 1;
}

.strain-image-container {
    margin: -24px -24px 20px -24px;
    height: 180px;
    overflow: hidden;
    border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
    position: relative;
    background: var(--bg-input);
}

.strain-image-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(16, 16, 26, 0.9) 100%);
    pointer-events: none;
}

.strain-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.strain-card:hover .strain-image {
    transform: scale(1.05);
}

.strain-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.strain-name {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.3;
}

.strain-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.strain-type-badge.indica {
    background: rgba(139, 92, 246, 0.12);
    color: var(--indica);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.strain-type-badge.sativa {
    background: rgba(245, 158, 11, 0.12);
    color: var(--sativa);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.strain-type-badge.hybrid {
    background: rgba(16, 185, 129, 0.12);
    color: var(--hybrid);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.strain-stars {
    display: flex;
    gap: 3px;
    margin-bottom: 14px;
}

.strain-stars .star {
    color: var(--star-empty);
    font-size: 16px;
    line-height: 1;
}

.strain-stars .star.filled {
    color: var(--star);
}

.strain-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}

.strain-meta-item {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.strain-meta-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.strain-effects {
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.strain-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.strain-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.strain-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.strain-card:hover .strain-actions {
    opacity: 1;
}

.strain-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.strain-actions button:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.strain-actions button.delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    grid-column: 1 / -1;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
    animation: floatIcon 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes floatIcon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

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

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* --- Modal Overlay --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-card);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-slow), box-shadow var(--transition-base), border-color var(--transition-base);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
}

.modal.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
    border-color: var(--danger);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.modal.success-pulse {
    animation: successPulse 0.6s ease-out;
    border-color: var(--accent);
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.2);
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 0;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}

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

.modal-body {
    padding: 24px 28px 28px;
}

/* --- Form Styles --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-base);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.07);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b8b9e' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6l3.5 3.5L11.5 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-select option {
    background: var(--bg-secondary);
}

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

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 28px;
}

/* --- Star Rating Input --- */
.star-rating-input {
    display: flex;
    gap: 4px;
}

.star-rating-input .star-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--star-empty);
    transition: color var(--transition-fast), transform var(--transition-fast);
    padding: 2px;
    line-height: 1;
}

.star-rating-input .star-btn:hover {
    transform: scale(1.15);
}

.star-rating-input .star-btn.filled {
    color: var(--star);
}

/* --- Password Prompt --- */
.password-prompt {
    text-align: center;
    padding: 20px 0;
}

.password-prompt p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.password-prompt .form-input {
    max-width: 300px;
    margin: 0 auto 16px;
    text-align: center;
}

.password-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 8px;
    display: none;
}

.password-error.show {
    display: block;
}

/* --- Toast Notification --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
}

.toast.success {
    border-left: 3px solid var(--accent);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

/* --- Detail Modal --- */
.detail-section {
    margin-bottom: 20px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.detail-meta-item {
    text-align: center;
}

.detail-meta-item .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-meta-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

/* --- Loading Spinner --- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Lightbox Modal --- */
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: zoomIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 0 40px var(--accent-glow);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.lightbox-close {
    position: absolute;
    top: -24px;
    right: -24px;
    background: rgba(16, 16, 26, 0.8);
    color: var(--text-primary);
    border-radius: 50%;
    padding: 8px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: var(--accent);
    color: #fff;
    transform: rotate(90deg) scale(1.1);
    border-color: var(--accent-hover);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {

    10%,
    90% {
        transform: scale(1) translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: scale(1) translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: scale(1) translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: scale(1) translate3d(4px, 0, 0);
    }
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes flashHighlight {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
        border-color: var(--accent);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
        border-color: var(--border-subtle);
    }
}

@keyframes slideOutScaleDown {
    to {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

@keyframes revealStagger {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

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

/* --- Added/Edited Highlights --- */


/* --- Custom Dropdown --- */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.custom-select-trigger:hover {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.08);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-arrow {
    width: 16px;
    height: 16px;
    stroke: var(--text-secondary);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: rotate(180deg);
    stroke: var(--accent);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(16, 16, 26, 0.85); /* Darker semi-transparent background */
    backdrop-filter: blur(16px); /* Strong blur effect */
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--accent);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 1000; /* Ensure it stays on top of everything inside modals */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.custom-select-wrapper.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.custom-select-option:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent);
}

.custom-select-option.selected {
    background: var(--bg-input);
    color: var(--accent);
    font-weight: 600;
}

.strain-card.edit-highlight {
    animation: flashHighlight 1.5s ease-out;
}

/* --- Hide Default Number Spinners --- */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

.strain-card.removing {
    animation: slideOutScaleDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: none;
}

/* --- Startup Header & Stats --- */
.header {
    animation: revealStagger 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.stats-bar .stat-card,
.controls-bar {
    animation: revealStagger 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.stats-bar .stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stats-bar .stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stats-bar .stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stats-bar .stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.controls-bar {
    animation-delay: 0.5s;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* Staggered grid animation */
.strain-card:nth-child(1) {
    animation-delay: 0.03s;
}

.strain-card:nth-child(2) {
    animation-delay: 0.06s;
}

.strain-card:nth-child(3) {
    animation-delay: 0.09s;
}

.strain-card:nth-child(4) {
    animation-delay: 0.12s;
}

.strain-card:nth-child(5) {
    animation-delay: 0.15s;
}

.strain-card:nth-child(6) {
    animation-delay: 0.18s;
}

.strain-card:nth-child(7) {
    animation-delay: 0.21s;
}

.strain-card:nth-child(8) {
    animation-delay: 0.24s;
}

.strain-card:nth-child(9) {
    animation-delay: 0.27s;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .logo-text {
        font-size: 1.15rem;
    }

    .stats-bar {
        gap: 6px;
    }

    .stat-card {
        min-width: 110px;
        padding: 12px 14px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        min-width: 100%;
    }

    .strain-grid {
        grid-template-columns: 1fr;
    }

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

    .modal {
        max-height: 95vh;
        border-radius: var(--radius-lg);
    }

    .modal-body {
        padding: 20px;
    }

    .modal-header {
        padding: 20px 20px 0;
    }

    .detail-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .strain-actions {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .stat-card {
        min-width: 90px;
        padding: 10px 12px;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .strain-card {
        padding: 18px;
    }
}

/* --- Startup Loader (Leaf Animation) --- */
.startup-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
    backdrop-filter: blur(32px) saturate(150%);
    -webkit-backdrop-filter: blur(32px) saturate(150%);
}

.startup-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-icon-container {
    width: 250px;
    height: 250px;
    margin-bottom: -15px;
    /* Pulls text closer to logo */
    animation: floatIcon 3s ease-in-out infinite, glowPulseImage 2.5s ease-in-out infinite alternate;
}

.loader-leaf {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.4));
}

@keyframes glowPulseImage {
    0% {
        filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.2));
        transform: scale(0.98);
    }

    100% {
        filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.6));
        transform: scale(1.02);
    }
}

@keyframes glowPulse {
    0% {
        filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.3));
        transform: scale(0.95);
    }

    100% {
        filter: drop-shadow(0 0 25px rgba(16, 185, 129, 0.8));
        transform: scale(1.05);
    }
}

@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 6px;
    text-transform: uppercase;
    z-index: 2;
    position: relative;
    display: inline-block;
}

.loader-text {
    /* Apply sweep to entire container text */
    background: linear-gradient(90deg,
            var(--text-primary) 0%,
            var(--text-primary) 30%,
            var(--accent) 40%,
            var(--accent-glow) 48%,
            #ffffff 50%,
            var(--accent-glow) 52%,
            var(--accent) 60%,
            var(--text-primary) 70%,
            var(--text-primary) 100%);
    background-size: 300% 100%;
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: lightSweep 4.5s linear infinite;
}

.loader-text span {
    /* Mobile Safari fix: only parent carries the sweeping gradient */
    color: transparent !important;
    -webkit-text-fill-color: transparent;
}

@keyframes lightSweep {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: -100% 50%;
    }
}

/* --- Mobile Startup Loader Adjustments --- */
@media (max-width: 600px) {
    .loader-icon-container {
        width: 160px;
        height: 160px;
        margin-bottom: -5px;
    }

    .loader-text {
        font-size: 1.5rem;
        letter-spacing: 3px;
        white-space: nowrap;
    }
}