:root {
    --primary: #1a73e8;
    /* Google Blue */
    --primary-dark: #1557b0;
    --success: #1e8e3e;
    /* Green */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-main: #202124;
    --text-muted: #5f6368;
    --border-color: #dadce0;
    --padding-std: 1rem;
    --radius-std: 8px;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e8eaed;
    --text-muted: #9aa0a6;
    --border-color: #3c4043;
    --primary: #8ab4f8;
    /* Lighter blue for dark mode */
    --primary-dark: #aecbfa;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

/* Utilities */
.hidden {
    display: none !important;
}

.container {
    max-width: 600px;
    /* Mobile focused max-width */
    margin: 0 auto;
    padding: 0 var(--padding-std);
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.8rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-theme="dark"] .app-header {
    background: rgba(30, 30, 30, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 850;
    font-size: 1.5rem;
    line-height: 1.1;
    letter-spacing: -1px;
}

.brand-name {
    background: linear-gradient(135deg, var(--primary), #0d47a1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.2px;
    margin-top: 4px;
    opacity: 0.9;
}

.badge {
    background: #e3f2fd;
    color: var(--primary);
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-left: 8px;
    border: 1.5px solid rgba(26, 115, 232, 0.15);
    display: inline-block;
    line-height: normal;
}

[data-theme="dark"] .badge {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
    border-color: rgba(26, 115, 232, 0.3);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 50%;
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.btn-nav-dropdown {
    background: transparent;
    color: var(--text-main);
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.btn-nav-dropdown:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .btn-nav-dropdown {
    color: #ffffff;
    /* Explicit white for contrast */
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .btn-nav-dropdown:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 2px;
    gap: 2px;
}

.lang-switcher a.lang-link,
.lang-switcher a.lang-link:link,
.lang-switcher a.lang-link:visited {
    text-decoration: none !important;
    color: var(--text-muted) !important;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 50px;
    transition: all 0.2s;
}

.lang-switcher a.lang-link:hover,
.lang-switcher a.lang-link:active {
    color: var(--primary) !important;
    background: rgba(26, 115, 232, 0.05);
    text-decoration: none !important;
}

.lang-switcher a.lang-link.active {
    background: var(--primary);
    color: white !important;
    text-decoration: none !important;
}

[data-theme="dark"] .lang-switcher {
    background: #2c2c2c;
}

[data-theme="dark"] .lang-switcher a.lang-link.active {
    background: var(--primary);
    color: #121212 !important;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--card-bg);
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 10000;
    margin-top: 8px;
    padding: 8px 0;
    flex-direction: column;
}

.dropdown-content.show {
    display: flex !important;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: var(--bg-color);
    color: var(--primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

/* Sections */
section {
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-std);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.hero {
    text-align: center;
    margin-top: 1rem;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    letter-spacing: -1px;
    color: var(--text-main);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-weight: 500;
}

/* Buttons */
.btn-primary-large {
    background: var(--success);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    width: 100%;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 4px 6px rgba(30, 142, 62, 0.2);
}

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

.btn-action {
    background: var(--primary);
    color: white;
    font-size: 1rem;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-std);
    width: 100%;
    margin-top: 1rem;
    cursor: pointer;
}

.btn-download {
    display: block;
    background: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 1rem;
    text-decoration: none;
    border-radius: var(--radius-std);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* Form Elements */
.upload-area {
    margin-top: 1.5rem;
}

.trust-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.radio-group,
.format-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.radio-chip {
    flex: 1;
    min-width: 80px;
    text-align: center;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    background: #fff;
}

.radio-chip:has(input:checked) {
    background: #e8f0fe;
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.radio-chip input {
    display: none;
}

[data-theme="dark"] .radio-chip {
    background: #2c2c2c;
    border-color: #444;
    color: var(--text-main);
}

[data-theme="dark"] .radio-chip:has(input:checked) {
    background: rgba(138, 180, 248, 0.15);
    /* Low opacity primary */
    border-color: var(--primary);
    color: var(--primary);
}

/* Prevention & Preview */
.preview-container {
    text-align: center;
    margin-bottom: 1rem;
    background: #f1f3f4;
    padding: 1rem;
    border-radius: var(--radius-std);
}

[data-theme="dark"] .preview-container {
    background: #2c2c2c;
    border: 1px solid #444;
}

#image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

/* Ads */
.ad-slot {
    background: transparent;
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    /* AdSense Policy: Spacing to prevent accidental clicks */
    margin-bottom: 2rem;
    background-color: rgba(0, 0, 0, 0.02);
    /* Placeholder bg */
    border-radius: 8px;
}

.ad-placeholder {
    color: #999;
    font-size: 0.8rem;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-links a {
    color: var(--text-muted);
    margin: 0 0.5rem;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.tools-nav {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tools-nav a {
    color: var(--text-main) !important;
    background: var(--bg-card) !important;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-weight: 500;
    display: inline-block;
    margin: 4px;
}

.tools-nav a:hover,
.tools-nav a.active {
    background: #e8f0fe;
    color: var(--primary);
    border-color: var(--primary);
}

[data-theme="dark"] .tools-nav a:hover,
[data-theme="dark"] .tools-nav a.active {
    background: rgba(138, 180, 248, 0.15);
}

/* Custom Input */
.form-input {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-std);
    font-size: 1rem;
    background: transparent;
    color: var(--text-main);
}

[data-theme="dark"] .form-input {
    background: #2c2c2c;
    border-color: #444;
    color: var(--text-main);
}

/* Secondary Button */
.btn-text {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--primary);
    padding: 0.8rem;
    width: 100%;
    margin-top: 0.5rem;
    border-radius: var(--radius-std);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-text:hover {
    background: #f1f3f4;
}

/* Navigation Button */
.btn-nav {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: transparent;
}

.btn-nav:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    text-decoration: none;
}

/* Button Styles Enhancement */
.btn-share,
.btn-help,
.btn-icon {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-share {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background: white;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-share:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.1);
}

[data-theme="dark"] .btn-share {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-theme="dark"] .btn-share:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.btn-help {
    text-decoration: none;
    padding: 0.5rem 1.2rem;
    border: 1.5px solid var(--primary);
    border-radius: 50px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.btn-help:hover {
    background: var(--primary);
    color: white !important;
}

[data-theme="dark"] .btn-help {
    border-color: var(--primary-dark);
    color: var(--primary-dark);
}

[data-theme="dark"] .btn-help:hover {
    background: var(--primary-dark);
    color: #121212 !important;
}

.btn-icon {
    font-size: 1.2rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f3f4;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

[data-theme="dark"] .btn-icon {
    background: #2c2c2c;
    border-color: #444;
}

.btn-icon:hover {
    background: #e8f0fe;
    border-color: var(--primary);
    transform: rotate(15deg);
}

/* Branding & Trust Extras */
.form-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.form-badges span {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.trust-badge-small {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0.8;
}

.success-note {
    font-size: 0.9rem;
    color: var(--success);
    font-weight: 500;
    margin-bottom: 1rem;
}

.share-prompt {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
    text-align: center;
}

.share-prompt p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.btn-whatsapp {
    background: #25d366;
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto; /* Added for share box centering */
    transition: transform 0.2s;
}

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

[data-theme="dark"] .form-badges span {
    background: #2c2c2c;
    border-color: #444;
}

[data-theme="dark"] .share-prompt {
    border-top-color: #444;
}

/* Persistent Support Section */
.support-section {
    background: linear-gradient(135deg, #f8f9fa, #e8f0fe);
    text-align: center;
    padding: 2.5rem 1.5rem;
    border-radius: var(--radius-std);
    margin: 2rem 0 1rem 0;
    border: 1px dashed var(--primary);
}

.support-content h3 {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.support-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.share-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    background: #1ebc57;
}

.btn-secondary-outline {
    background: transparent;
    border: 2px solid var(--text-muted);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-secondary-outline:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--text-main);
}

[data-theme="dark"] .support-section {
    background: linear-gradient(135deg, #1f1f1f, #252525);
    border-color: #444;
}

[data-theme="dark"] .btn-secondary-outline {
    border-color: #666;
    color: #eee;
}

[data-theme="dark"] .btn-secondary-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}

.donate-link {
    color: var(--text-main);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: #FFDD00;
    text-decoration-thickness: 3px;
    transition: all 0.2s;
}

.donate-link:hover {
    background-color: #FFDD00;
    color: #000;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
}

@media (max-width: 480px) {
    .app-header {
        padding: 0.7rem 1rem;
    }

    .app-header nav {
        gap: 0.6rem !important;
        /* Better spacing for small screens */
    }

    /* Stack logo in column on mobile */
    .logo {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        line-height: 1;
        font-size: 1.25rem;
    }

    .badge {
        margin-left: 0;
        margin-top: 2px;
        font-size: 0.55rem;
        padding: 1px 6px;
    }

    .btn-nav-dropdown,
    .btn-share,
    .btn-nav {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
    }

    .lang-switcher a.lang-link {
        padding: 2px 6px;
        font-size: 0.7rem;
    }

    .btn-share {
        font-size: 0;
        /* Hide text */
        gap: 0;
    }

    .btn-share svg {
        width: 16px;
        height: 16px;
        margin: 0;
    }

    .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 1rem;
        padding: 0;
    }

    .tagline,
    .btn-help {
        display: none !important;
    }

    .hero h1 {
        font-size: 1.8rem;
    }
}

/* Animations */
@keyframes highlight-input {
    0% {
        border-color: var(--border-color);
        background: transparent;
    }

    50% {
        border-color: var(--success);
        background: rgba(30, 142, 62, 0.1);
    }

    100% {
        border-color: var(--border-color);
        background: transparent;
    }
}

/* Crop Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    /* Ensure it fits on mobile screens */
}

.modal-content h3 {
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-main);
}

.img-container {
    width: 100%;
    height: 60vh;
    /* Dedicated height for cropping area */
    background-color: #f0f0f0;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
    position: relative;
}

.img-container img {
    max-width: 100%;
    display: block;
    /* Important for Cropper.js */
}

.crop-controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: auto;
}

.crop-controls button {
    flex: 1;
    padding: 0.8rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    border: none;
    transition: transform 0.1s;
}

.crop-controls button:active {
    transform: scale(0.98);
}

#rotate-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

#crop-confirm-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(26, 115, 232, 0.3);
}

/* Mobile Tweaks */
@media (max-width: 480px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        padding: 1rem;
    }

    .img-container {
        height: 70vh;
        /* More space for image on mobile */
    }

    .crop-controls {
        padding-bottom: 1rem;
    }
}

/* PWA Install Prompt */
.pwa-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    background: var(--card-bg);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 400px;
}

.pwa-prompt.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--bg-color);
}

.pwa-text {
    flex: 1;
}

.pwa-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.pwa-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.btn-install {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.btn-close-pwa {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0 0 5px;
    line-height: 1;
}

[data-theme="dark"] .pwa-prompt {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    background: #252525;
}