:root {
    --primary: #00b4d8;
    --primary-hover: #0077b6;
    --bg-dark: #030a16;
    --card-bg: rgba(17, 34, 64, 0.7);
    --border-color: rgba(0, 180, 216, 0.2);
    --text-primary: #e6f1ff;
    --text-secondary: #8892b0;
    --success: #10b981;
    --error: #ef4444;
    --info: #00b4d8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Background animated blobs */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.6;
    border-radius: 50%;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(0, 180, 216, 0.2) 0%, rgba(0, 180, 216, 0) 70%);
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(0, 119, 182, 0.2) 0%, rgba(0, 119, 182, 0) 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 60%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, rgba(144, 224, 239, 0.15) 0%, rgba(144, 224, 239, 0) 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(10%, 10%) scale(1.1);
    }
}

/* Layout Container */
.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    z-index: 10;
    position: relative;
}

/* Auth Header */
.auth-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1.5rem;
    min-height: 48px;
    flex-wrap: wrap;
    gap: 10px;
}

#loggedInView {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.email-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.credits-pill {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

/* Redefine History button position since it moved inside the Auth Header */
.floating-history-btn {
    position: relative;
    top: auto;
    right: auto;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1, h2, h3, h4, h5, h6, .btn-primary {
    font-family: 'Outfit', sans-serif;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.highlight {
    background: linear-gradient(135deg, #90e0ef, #00b4d8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Glass Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.badge {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    margin-left: 0.5rem;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(0, 180, 216, 0.1);
    box-shadow: 0 0 15px rgba(0, 180, 216, 0.4);
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.upload-icon {
    color: var(--primary);
    transition: transform 0.3s ease;
}

.drop-zone:hover .upload-icon {
    transform: translateY(-5px);
}

.or-divider {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.file-label {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

input[type="file"] {
    display: none;
}

/* File info when selected */
.file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 1rem;
    border-radius: 12px;
}

.file-info span {
    color: var(--success);
    font-weight: 600;
    word-break: break-all;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--error);
}

.hidden {
    display: none !important;
}

/* Inputs & Selects */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-secondary);
    pointer-events: none;
}

select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    appearance: none;
}

select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(0, 180, 216, 0.2);
}

select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

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

/* Buttons */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #030a16;

    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary .btn-text, .btn-primary svg {
    color: #030a16;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.5);
    background: linear-gradient(135deg, #90e0ef, var(--primary));
    color: #030a16;
}

.btn-primary:hover .btn-text, .btn-primary:hover svg {
    color: #030a16;
}

.btn-primary:active {
    transform: translateY(0);
}

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

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    position: absolute;
}

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

/* Google Login Button */
.btn-google {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    font-family: 'Outfit', sans-serif;
}

.btn-google:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.google-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

/* Progress Bar */
.progress-container {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #90e0ef);
    border-radius: 4px;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(0, 180, 216, 0.5);
}

/* Result Zone */
.result-zone {
    text-align: center;
    padding-top: 1rem;
}

.success-message {
    margin-bottom: 2rem;
}

.success-icon {
    color: var(--success);
    margin-bottom: 1rem;
    width: 48px;
    height: 48px;
}

.success-message h3 {
    color: var(--success);
    font-weight: 400;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-secondary.sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 0;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--text-primary);
}

/* History System & Modals */
.floating-history-btn:hover {
    background: rgba(0, 180, 216, 0.2);
    border-color: var(--primary);
    transform: scale(1.05);
}

.history-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: flex;
    justify-content: flex-end;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.history-overlay.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    display: none !important;
}

.history-panel {
    width: 100%;
    max-width: 450px;
    height: 100vh;
    border-radius: 0;
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
    border-right: none;
    border-top: none;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 2rem;
}

.history-overlay.hidden .history-panel {
    transform: translateX(100%);
}

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

.history-header h2 {
    font-size: 1.5rem;
    font-weight: 500;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.5rem;
}

/* Custom Scrollbar for history list */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.empty-history {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 0;
    font-style: italic;
}

.history-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.history-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-break: break-all;
    font-size: 1rem;
}

.history-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.history-date {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    min-width: 250px;
    max-width: 350px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid var(--primary);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.info {
    border-left-color: var(--info);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-header {
        justify-content: center;
        margin-top: 1rem;
    }

    .lang-switcher {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    .auth-controls {
        width: 100%;
        justify-content: center;
    }

    #loggedInView {
        justify-content: center;
        gap: 0.5rem;
    }

    .user-badge {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

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

    .glass-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .history-panel {
        border-radius: 0;
    }

    .floating-history-btn {
        top: auto;
        right: auto;
    }

    .toast-container {
        bottom: 20px;
        left: 20px;
        right: 20px;
    }

    .toast {
        max-width: 100%;
    }
}

/* Store Package UI */
.promo-btn {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

.promo-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.3));
    border-color: rgba(245, 158, 11, 0.5);
    transform: scale(1.05);
}

.store-package {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1rem;
    text-align: center;
}

.package-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.package-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fcd34d;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 4px;
}

.package-price .currency {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.package-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Payment Methods Area */
.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 10px;
}