:root {
    --bg-color: #f0f4f8;
    --card-bg: rgba(255, 255, 255, 0.85);
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: rgba(229, 231, 235, 0.5);
    --success: #10B981;
    --danger: #EF4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-x: hidden;
    overflow-y: auto;
}

.app-background {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, #e0c3fc 0%, #8ec5fc 100%);
    z-index: -1;
    animation: drift 20s ease-in-out infinite alternate;
}

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

    100% {
        transform: translate(-2%, 2%) scale(1.05);
    }
}

.container {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

.app-header {
    text-align: center;
    margin-bottom: 24px;
}

.icon-container {
    background: linear-gradient(135deg, var(--primary), #8B5CF6);
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto 16px;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.app-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.device-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.5);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.disconnected {
    background-color: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.connected {
    background-color: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.primary-btn {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.action-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    font-size: 1.1rem;
    border-radius: 12px;
    margin-top: 16px;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
}

.action-btn:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
    display: inline-block;
}

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231F2937%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 12px auto;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: white;
}

.preview-container {
    background: #fff;
    border: 1px dashed var(--primary);
    border-radius: 8px;
    padding: 16px;
    margin-top: 24px;
    margin-bottom: 16px;
    text-align: center;
}

.preview-container label {
    margin-bottom: 12px;
}

.label-preview {
    /* Simulating 58mm printer aspect/width constraints (approx 384 dots width = 48 chars) */
    width: 250px;
    margin: 0 auto;
    font-family: monospace;
    color: black;
    text-align: center;
    padding: 10px;
    background-color: white;
    border: 1px solid #eee;
}

.preview-name {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.preview-price {
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: bold;
}

.preview-notes {
    font-size: 0.85rem;
    color: #444;
}

.brand-header {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 12px;
}

.divider {
    font-size: 0.8rem;
    color: #000;
    margin: 4px 0;
    letter-spacing: -1px;
}

footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Base CSS End */