:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #0f172a, #1e1b4b, #2e1065);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.85); /* For second tool */
    --border-color: #334155;
    --radius: 24px;
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-gradient);
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    padding: 20px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 900px; /* Increased to accommodate both */
    perspective: 1000px;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn {
    flex: 1;
    background: transparent;
    padding: 12px 20px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: slideUp 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

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

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Centered style for simple barcode tab - removed to allow grid expansion */
#tab-barcode .card {
    /* max-width: 500px; */
    margin: 0 auto;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(to right, #c084fc, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

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

input[type="text"], input[type="url"] {
    width: 100%;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.color-input-group {
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.color-input-group label {
    margin-bottom: 0;
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch {
    border-radius: 8px;
    border: 2px solid var(--glass-border);
}

/* File Upload Logic */
input[type="file"] {
    display: none;
}

.file-name {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

label[for="qr-logo"], .file-upload-label {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--text-secondary);
    padding: 1rem;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

label[for="qr-logo"]:hover, .file-upload-label:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #818cf8;
    color: #818cf8;
}

button {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    margin-top: 1rem;
}

/* Mobile QR Specific - Grid Layout */
.grid-layout {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

@media (min-width: 768px) {
    .grid-layout {
        flex-direction: row;
        align-items: flex-start;
    }
}

.input-section {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .icon {
    position: absolute;
    right: 14px;
    color: #64748b;
    pointer-events: none;
}

.input-with-icon input {
    padding-right: 45px !important;
}

.color-options {
    display: flex;
    gap: 1rem;
}

.color-options .input-group {
    flex: 1;
    margin-bottom: 0;
}

#qr-code-container, #qr-canvas {
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    margin: 2rem auto 0;
    overflow: hidden; /* Prevent bleed through */
}

#qr-code-container svg, #qr-code-container canvas,
#qr-canvas svg, #qr-canvas canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.qr-placeholder {
    color: #64748b;
    font-weight: 600;
    border: 2px dashed #475569;
    background: transparent !important;
    box-shadow: none !important;
    text-align: center;
}

.downloads-container {
    width: 100%;
}

.download-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 0.9rem;
    padding: 10px;
}

.action-btn:not(:disabled):hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* Slug Status Styles */
.slug-status {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 1.2rem;
    transition: all 0.3s ease;
}

.slug-status.loading {
    color: var(--text-secondary);
}

.slug-status.exist {
    color: #34d399; /* Green for existing/found */
}

.slug-status.available {
    color: #60a5fa; /* Blue for new/available */
}

.slug-status.error {
    color: #f87171; /* Red for error */
}

.hidden {
    display: none !important;
}
