/* ===== CSS Variables ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #a855f7;
    --bg-body: #f1f5f9;
    --bg-gradient-start: #f1f5f9;
    --bg-gradient-end: #e0e7ff;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-sec: #64748b;
    --border: #e2e8f0;
    --bg-app: #f8fafc;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 24px;
}

/* Dark Mode */
body.dark {
    --bg-body: #0f172a;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e1b4b;
    --surface: #1e293b;
    --text-main: #f8fafc;
    --text-sec: #94a3b8;
    --border: #334155;
    --bg-app: #1e293b;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

/* ===== App Container ===== */
#app-root {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    max-height: 900px;
    background: var(--surface);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

@media (min-width: 450px) {
    #app-root {
        height: 90vh;
        border-radius: var(--radius);
    }
}

/* ===== Header ===== */
.app-header {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10;
    border-bottom: 1px solid transparent;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.app-name {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
    color: var(--text-main);
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon,
.btn-back {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-sec);
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover,
.btn-back:hover {
    background: var(--bg-app);
    color: var(--primary);
}

/* Theme Toggle Icons */
.icon-sun {
    display: none;
}

body.dark .icon-moon {
    display: none;
}

body.dark .icon-sun {
    display: block;
}

/* ===== Landing Page ===== */
.landing-main {
    flex: 1;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.hero-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1.5px;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-sec);
    font-weight: 400;
}

/* ===== Feature Cards ===== */
.feature-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(99, 102, 241, 0.25);
    border-color: var(--primary);
}

.feature-card.primary {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
}

.feature-card.primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.card-content {
    flex: 1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.card-description {
    font-size: 0.85rem;
    color: var(--text-sec);
    font-weight: 400;
}

.card-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-arrow {
    color: var(--text-sec);
    transition: transform 0.3s;
}

.feature-card:hover .card-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* ===== Page Content ===== */
.page-main {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.page-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-sec);
    font-weight: 400;
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 1.1rem;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: transform 0.1s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Inputs ===== */
.input-card {
    width: 100%;
    background: var(--bg-app);
    border-radius: 16px;
    padding: 1.1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid transparent;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.input-card:focus-within {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.url-input,
.text-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-main);
    text-align: center;
    line-height: 1.5;
    font-family: inherit;
}

.url-input::placeholder,
.text-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

textarea.text-input {
    min-height: 150px;
    resize: vertical;
    text-align: left;
    padding: 1rem;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

.spinner {
    animation: spin 1s linear infinite;
}

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

/* ===== Toast Notifications ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease;
    z-index: 1000;
    max-width: 350px;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-sec);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

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

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

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

/* ===== Progress Bar ===== */
.progress-container {
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-app);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-sec);
}

.progress-percent {
    font-weight: 600;
    color: var(--primary);
}

/* ===== Secondary Button ===== */
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: var(--bg-app);
    color: var(--primary);
}

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

/* ===== Result Actions ===== */
.result-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

@media (max-width: 450px) {
    .result-actions {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.result-actions .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 0.75rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.result-actions .btn-secondary svg {
    width: 16px;
    height: 16px;
}

/* ===== Footer ===== */
.app-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-sec);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.app-footer strong {
    color: var(--primary);
    font-weight: 700;
}

/* ===== Platform Logos ===== */
.platforms-section {
    margin: 2rem 0 1rem;
    text-align: center;
}

.platforms-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-sec);
    margin-bottom: 1rem;
    font-weight: 600;
}

.platform-logos {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    align-items: center;
}

.platform-icon {
    width: 32px;
    height: 32px;
    fill: var(--text-sec);
    transition: all 0.3s;
    cursor: pointer;
}

.platform-icon:hover {
    fill: var(--primary);
    transform: scale(1.1);
}

/* ===== Translation Modal ===== */
.translate-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.translate-modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-size: 1.3rem;
}

.modal-content select {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 1rem;
    cursor: pointer;
}

.modal-content select:focus {
    border-color: var(--primary);
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions button {
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

/* ===== Info Badge ===== */
.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-sec);
    margin: 1rem 0;
}

.info-badge svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ===== Button Font Override ===== */
.btn-primary,
.btn-secondary,
button {
    font-family: 'Outfit', sans-serif !important;
    letter-spacing: 0.3px;
}