:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: #f3f4f6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

/* Dynamic Background */
.background-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.6;
    animation: float 20s infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: #a78bfa;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: #60a5fa;
    bottom: -50px;
    right: -50px;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, 50px) rotate(10deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Main Layout */
.main-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin-top: 50px;
    position: relative;
    z-index: 1;
}

.glass-container {
    flex: 2;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    margin-bottom: 2rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 1.8rem;
    /* Slightly smaller to fit */
    color: var(--text-color);
    font-weight: 600;
    margin: 0;
}

.lang-switch {
    display: flex;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 2px;
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.lang-btn:hover:not(.active) {
    color: var(--primary-color);
}

.badge {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 8px;
    vertical-align: middle;
}

header p {
    color: var(--text-light);
    font-size: 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.4);
    padding: 0.5rem;
    border-radius: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    color: var(--text-light);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: none;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--primary-color);
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

/* Forms & Inputs */
.form-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

label {
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    color: var(--text-color);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

textarea {
    resize: none;
}

select {
    cursor: pointer;
}

/* Accordion */
.accordion {
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 1rem 1.5rem;
    background: transparent;
    color: var(--text-color);
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    box-shadow: none;
    font-weight: 600;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.2);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.accordion-content.open {
    padding-bottom: 1.5rem;
    max-height: 500px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 50px;
    border-radius: 12px;
    cursor: pointer;
    background: none;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Preview, Button & History */
.preview-area {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.secondary-btn {
    background: white;
    color: var(--text-color);
    border: 2px solid #e5e7eb;
    box-shadow: none;
}

.secondary-btn:hover {
    background: #f9fafb;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Scanner */
.scanner-wrapper {
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    min-height: 250px;
}

#reader {
    width: 100%;
    height: 100%;
}

#scan-result {
    padding: 1rem;
    background: #ecfdf5;
    color: #065f46;
    border-radius: 12px;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #6ee7b7;
}

#scan-result.hidden {
    display: none;
}

/* History Panel Styling */
.history-panel {
    flex: 1;
    min-width: 300px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-panel h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.6);
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--primary-color);
}

.history-item:hover {
    background: white;
    transform: translateX(5px);
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 5px;
}

#clear-history {
    background: #ef4444;
    padding: 0.5rem;
    font-size: 0.9rem;
    margin-top: auto;
}

#clear-history:hover {
    background: #dc2626;
}

/* Mobile Toggle Button */
.mobile-only-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.mobile-only-btn span {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .main-wrapper {
        flex-direction: column;
        padding: 1rem;
        margin-top: 20px;
        gap: 0;
    }

    .glass-container {
        width: 100%;
        padding: 1.5rem;
        border-radius: 20px;
        margin-bottom: 80px;
        /* Space for FAB */
    }

    .history-panel {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 350px;
        height: 100vh;
        max-height: 100vh;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        z-index: 200;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 20px 0 0 20px;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
        padding-top: 4rem;
    }

    .history-panel.open {
        right: 0;
    }

    .history-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.3);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .history-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .mobile-only-btn {
        display: flex;
    }

    .grid-2,
    .accordion-content {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tabs {
        padding: 0.25rem;
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }
}