:root {
    --bg-dark: #0a0a0a;
    --bg-darker: #000000;
    --text-light: #ffffff;
    --text-muted: #999999;
    --accent-cyan: #00d9ff;
    --accent-purple: #d946ef;
    --accent-blue: #4a90e2;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --border-color: #333333;
    --card-bg: rgba(26, 26, 26, 0.6);
}

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

body {
    background-color: var(--bg-dark);
    background-image: linear-gradient(135deg, rgba(74, 144, 226, 0.05) 0%, rgba(80, 227, 194, 0.05) 100%);
    color: var(--text-light);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    padding: 2rem;
    padding: max(2rem, env(safe-area-inset-top)) 2rem max(2rem, env(safe-area-inset-bottom)) 2rem;
    display: flex;
    flex-direction: column;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(74, 144, 226, 0.2);
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    /* Ensure text is readable on gradient */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Main Content Area */
.main-content {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    display: grid;
    gap: 2rem;
}

/* Form Controls */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.input-row .input-group {
    flex: 1;
    min-width: 150px;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.app-input,
.app-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    /* Monospace for precise input */
    transition: all 0.3s ease;
}

.app-input:focus,
.app-select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.2);
}

.app-select option {
    background: var(--bg-dark);
    color: var(--text-light);
}

.app-color {
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 45px;
    background: transparent;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    /* Not widely supported for color input but worth try */
    overflow: hidden;
}

.app-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.app-color::-webkit-color-swatch {
    border: 2px solid var(--border-color);
    border-radius: 8px;
}


.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-light);
    font-weight: 500;
    user-select: none;
}

.checkbox-label input {
    accent-color: var(--accent-cyan);
    width: 18px;
    height: 18px;
}

/* Buttons */
.btn-primary {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.4);
}

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

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    color: var(--text-light);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.2);
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.barcode-wrapper {
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    /* Slightly lighter wrapper */
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    overflow-x: auto;
    border: 2px dashed var(--border-color);
}

#barcode {
    max-width: 100%;
    height: auto;
    min-height: 100px;
    /* Prevent collapse when empty */
}

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

.api-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 1rem;
    word-break: break-all;
}

.api-info code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-cyan);
}

/* Footer (Copied from timer.css) */
.app-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-dark);
    /* Ensure footer blends with page bottom */
}

.app-footer p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.app-footer a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.3s ease;
}

.app-footer a:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

.app-footer .bmc-logo {
    display: inline-block;
    margin-top: 1rem;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.app-footer .bmc-logo:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.app-footer .bmc-logo img {
    height: 60px;
    width: 217px;
}

.view-all-apps-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem auto 0 auto;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-cyan));
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    width: fit-content;
}

.view-all-apps-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 242, 255, 0.3);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 600px) {
    .input-row {
        flex-direction: column;
        gap: 1rem;
    }

    .barcode-wrapper {
        padding: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}