/* ============================================
   Don't Get Wolfed - Professional PWA Styles
   ============================================ */

/* Base Variables */
:root {
    /* Dark Mode (Default) */
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --border-radius: 16px;
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-border: #334155;
    --primary-color: #60a5fa;

    /* Accessibility */
    --focus-ring: 2px solid #60a5fa;
    --focus-ring-offset: 2px;
}

.light-mode {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --primary-color: #3b82f6;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px;
    flex: 1;
}

/* ============================================
   Header & Navigation
   ============================================ */

/* Let .top-bar be the real header layout */
header {
    padding: 0;
    background: transparent;
    width: 100%;
    z-index: 100;
    position: sticky;
    top: 0;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-color);
    width: 100%;
}

.top-bar-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    display: none;
    /* Hide on mobile by default if needed, or keep */
}

@media (min-width: 640px) {
    .logo h1 {
        display: block;
    }
}

.logo-img {
    height: 40px;
    width: auto;
    border-radius: 8px;
}

/* Make right-side buttons stay in one row */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.top-bar-right>* {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Buttons */
.icon-pill {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.icon-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.upgrade-pill {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.profile-pill {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.profile-pill:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

#profile-initial {
    background: var(--accent-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Legacy Button Styles (keeping for compatibility if used elsewhere) */
.btn-icon-only {
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
    border: none;
}

.btn-icon-only svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-primary);
    transition: stroke 0.2s ease;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.08);
}

.btn-icon-only:active {
    transform: scale(0.95);
}

.btn-icon-only:focus {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.light-mode .btn-icon-only:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-primary-small {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary-small svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.btn-primary-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary-small:active {
    transform: translateY(0);
}

.btn-primary-small:focus {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* Credits Info */
.credits-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 8px;
}

/* ============================================
   Cards & Sections
   ============================================ */

.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    animation: fadeIn 0.5s ease-out;
    transition: background-color 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.light-mode .card {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

h2 {
    font-size: 1.35rem;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.instruction {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ============================================
   Form Inputs
   ============================================ */

.input-wrapper {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-header {
    display: flex;
    gap: 10px;
}

.mode-select {
    flex: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.mode-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mode-select option {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.btn-icon-small {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.btn-icon-small:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.btn-icon-small:focus {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* Image Preview */
#image-preview-container {
    position: relative;
    width: 100%;
    max-height: 200px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--input-border);
}

#image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.btn-close-small {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: background-color 0.2s ease;
}

.btn-close-small:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Textarea */
textarea {
    width: 100%;
    height: 120px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    transition: border-color 0.2s ease, background-color 0.3s ease;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-secondary:focus {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* ============================================
   Results & Status
   ============================================ */

.hidden {
    display: none !important;
}

#loading-indicator {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

.light-mode .spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-left-color: var(--accent-color);
}

#status-header {
    text-align: center;
    margin-bottom: 24px;
    padding: 24px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
}

.light-mode #status-header {
    background-color: rgba(0, 0, 0, 0.02);
}

#status-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

#status-title {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

.status-safe {
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-warning {
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-danger {
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.explanation,
.advice {
    margin-bottom: 24px;
    background-color: var(--input-bg);
    padding: 16px;
    border-radius: 12px;
}

.explanation h4,
.advice h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.explanation p,
.advice p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Deep Analysis */
.deep-analysis-container {
    margin-bottom: 24px;
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 16px;
    background: rgba(59, 130, 246, 0.05);
}

.deep-analysis-container h4 {
    color: var(--accent-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.deep-analysis-content-wrapper {
    position: relative;
}

.blurred-content {
    filter: blur(4px);
    user-select: none;
    opacity: 0.7;
}

.locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    backdrop-filter: blur(2px);
    gap: 12px;
}

.lock-icon {
    width: 32px;
    height: 32px;
    color: white;
}

.locked-overlay p {
    color: white;
    font-weight: 600;
}

/* ============================================
   Modals
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--input-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2,
.modal-header h3 {
    font-size: 1.3rem;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s ease;
}

.btn-close:hover {
    color: var(--text-primary);
}

.btn-close:focus {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--input-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* History Modal */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-history {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

.history-item {
    padding: 16px;
    background-color: var(--input-bg);
    border-radius: 12px;
    border: 1px solid var(--input-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-status {
    font-size: 1.2rem;
}

.history-item-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-item-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pricing Modal */
.pricing-content {
    max-width: 600px;
}

.pricing-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.pricing-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 600px) {
    .pricing-cards {
        grid-template-columns: 1fr 1fr;
    }
}

.pricing-card {
    background-color: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    transition: all 0.2s ease;
}

.pricing-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-4px);
}

.pricing-card.popular {
    border-color: var(--accent-color);
    background: linear-gradient(135deg,
            rgba(59, 130, 246, 0.1),
            rgba(37, 99, 235, 0.05));
}

.popular-tag {
    position: absolute;
    top: -12px;
    right: 20px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pricing-card .card-header h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    display: block;
    margin-bottom: 4px;
}

.price small {
    font-size: 1rem;
    color: var(--text-secondary);
}

.savings {
    display: inline-block;
    background: var(--success-color);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.features-list {
    list-style: none;
    padding: 16px 0;
    margin-bottom: 16px;
}

.features-list li {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-decoration: none;
    text-align: center;
    margin-top: auto;
}

.btn-glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.guarantee-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Settings Modal */
.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-body input[type="password"],
.modal-body input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.help-text {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-text a {
    color: var(--accent-color);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

/* ============================================
   Footer
   ============================================ */

footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Accessibility & Focus States
   ============================================ */

/* High contrast focus for keyboard navigation */
*:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* Skip to content link (for screen readers) */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .card {
        padding: 20px;
    }

    h1 {
        font-size: 1.25rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    .logo-img {
        height: 40px;
    }

    .btn-icon-only svg {
        width: 18px;
        height: 18px;
    }

    .modal-content {
        border-radius: 12px;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    body {
        background: white;
        color: black;
    }

    .header-actions,
    .btn-primary,
    .btn-secondary,
    footer {
        display: none;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}

/* ============================================
   Refactored Header Styles
   ============================================ */

/* --- Mobile Responsiveness --- */
@media (max-width: 640px) {
    .top-bar {
        padding: 0.75rem 1rem;
    }

    .top-bar-left h1 {
        font-size: 1.1rem;
    }

    .top-bar-right {
        gap: 8px;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .upgrade-pill {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }

    .profile-pill span#profile-label {
        display: none;
        /* Hide label on very small screens */
    }

    .profile-pill {
        padding: 4px;
        /* Circle only on mobile */
    }
}