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

:root {
    --primary: #1a237e;
    --bg: #f0f2f5;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --white: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app-container {
    display: flex;
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    max-width: 1400px;
    width: 100%;
    min-height: 85vh;
    overflow: hidden;
}

.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1a237e 0%, #0d1445 100%);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 30px;
}

.logo-brand .highlight { color: #64b5f6; }

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    font-weight: 500;
    width: 100%;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.15); color: white; }

.sidebar-footer {
    color: rgba(255,255,255,0.4);
    font-size: 0.65rem;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.main-content {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    max-height: 85vh;
}

.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }

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

.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.section-header p {
    color: var(--text-light);
    margin-top: 4px;
}

.badge-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.upload-box {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s;
    background: #fafbfc;
}

.upload-box:hover {
    border-color: var(--primary);
    background: #f8f9ff;
}

.upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
    min-height: 120px;
    justify-content: center;
}

.upload-preview span {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text);
}

.upload-preview small {
    color: var(--text-light);
    font-size: 0.7rem;
}

.upload-preview img[alt="Logo Aziendale"] {
    max-height: 40px !important;
    max-width: 80px !important;
    object-fit: contain;
}

.upload-box .btn-upload,
.upload-box .btn-camera,
.upload-box .btn-remove {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
    margin: 2px;
}

.upload-box .btn-upload {
    background: var(--primary);
    color: white;
}
.upload-box .btn-upload:hover { background: #0d1445; transform: translateY(-2px); }

.upload-box .btn-camera {
    background: #10b981;
    color: white;
}
.upload-box .btn-camera:hover { background: #059669; transform: translateY(-2px); }

.upload-box .btn-remove {
    background: #ef4444;
    color: white;
}
.upload-box .btn-remove:hover { background: #dc2626; transform: translateY(-2px); }

.options-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text);
}

.switch-label input { display: none; }

.switch-slider {
    width: 40px;
    height: 22px;
    background: #d1d5db;
    border-radius: 11px;
    position: relative;
    transition: all 0.3s;
    flex-shrink: 0;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.switch-label input:checked + .switch-slider { background: var(--primary); }
.switch-label input:checked + .switch-slider::before { transform: translateX(18px); }

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 10px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: #0d1445;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26,35,126,0.3);
}

.btn-secondary {
    background: #f3f4f6;
    color: var(--text);
}
.btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

#badgePreview { margin-top: 24px; }

.badge-wrapper {
    display: flex;
    justify-content: center;
    padding: 24px;
    background: #f8fafc;
    border-radius: 12px;
}

.badge-scale {
    width: 204px;
    height: 325px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    flex-shrink: 0;
}

.badge {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.badge-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.setting-card {
    background: #f8fafc;
    padding: 16px;
    border-radius: 10px;
}

.setting-card h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.color-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}
.color-btn:hover { transform: scale(1.1); }
.color-btn.active { border-color: #1a1a2e; transform: scale(1.1); }

.setting-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 12px;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-light);
}

.watermark-badge {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.watermark-text-container {
    display: flex;
    flex-wrap: wrap;
    align-content: space-evenly;
    justify-content: space-evenly;
    white-space: nowrap;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 3px rgba(255,255,255,0.3);
    word-break: break-word;
    padding: 5px;
}

.watermark-text-container.repeated {
    position: absolute;
    top: -10%;
    left: -5%;
    width: 110%;
    height: 120%;
}

.watermark-text-container.single {
    position: relative;
    width: auto;
    height: auto;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    padding: 10px;
}

@media (max-width: 1024px) {
    .settings-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; min-height: auto; border-radius: 16px; }
    .sidebar {
        width: 100%;
        padding: 12px 16px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .logo-brand { padding-bottom: 0; border-bottom: none; margin-bottom: 0; font-size: 1rem; }
    .nav-menu { flex-direction: row; gap: 4px; }
    .nav-item { padding: 6px 10px; font-size: 0.75rem; width: auto; }
    .nav-item span { display: none; }
    .sidebar-footer { display: none; }
    .main-content { padding: 16px; max-height: none; }
    .form-row, .upload-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .options-row { flex-direction: column; gap: 8px; }
    .badge-scale { width: 170px; height: 271px; }
    .badge-actions { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
    .badge-scale { width: 140px; height: 223px; }
}
