*:not(:defined) {
    display: none
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--fg);
    overflow-x: hidden;
}

label {
    color: var(--label)
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--input-bd);
    background: var(--input-bg);
    color: var(--input-fg);
    caret-color: var(--input-fg);
}

input:not([type="email"]):not([type="hidden"]):not([type="checkbox"]),
select,
.ts-wrapper.single .ts-control .item,
.ts-wrapper.single .ts-control input {
    text-transform: uppercase;
}

input[type="email"] {
    text-transform: none;
}

input:focus,
select:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-color: var(--focus);
}

.container {
    padding: 16px
}

.card {
    border: 1px solid rgba(127, 127, 127, .1);
    border-radius: 12px;
    padding: 16px;
    background: var(--bg);
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

.col {
    flex: 1 1 200px;
    min-width: 180px
}

label {
    display: block;
    font-size: 13px;
    opacity: .85;
    margin: 8px 0 6px
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 20px
}

button {
    appearance: none;
    border-radius: 10px;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    border: 1px solid transparent;
}

button[type="submit"] {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border-color: var(--btn-primary-bg);
    flex: 1;
}

button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

button[type="reset"] {
    background: transparent;
    color: var(--btn-secondary-fg);
    border-color: var(--input-bd);
}

.small {
    font-size: 12px;
    opacity: .7;
    line-height: 1.4;
}

.hp {
    display: none !important
}

/* Success & Error Messages */
#status-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    text-align: center;
}

.msg-error {
    background: rgba(255, 0, 0, 0.15);
    color: var(--fg);
    border: 1px solid rgba(255, 0, 0, 0.3);
}

/* Stile Successo e Codice */
#success-view {
    display: none;
    text-align: center;
    padding: 20px 0;
    animation: fadein 0.5s;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

.code-display {
    font-family: 'Courier New', monospace;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 4px;
    background: rgba(127, 127, 127, 0.15);
    border: 2px dashed var(--focus);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    user-select: all;
    color: var(--fg);
}

.code-info {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: left;
}

.code-info p {
    margin-bottom: 12px;
}

.success-accent {
    color: var(--btn-primary-bg);
    font-weight: 700;
}

.nota {
    text-align: center;
    font-size: 12px;
}

.loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Legal Checkboxes Styles */
.manual-city-input {
    width: 100%;
    box-sizing: border-box;
}

.legal-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(127, 127, 127, 0.1);
}

.legal-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    cursor: pointer;
    user-select: none;
}

.legal-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.legal-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--label);
    margin: 0;
}

.legal-text a {
    color: var(--btn-primary-bg);
    text-decoration: none;
    font-weight: 600;
}

.legal-text a:hover {
    text-decoration: underline;
}

/* Tom Select Overrides */
.ts-wrapper.single .ts-control {
    background: var(--input-bg) !important;
    color: var(--input-fg) !important;
    border-color: var(--input-bd) !important;
}

.ts-dropdown {
    background: var(--input-bg) !important;
    color: var(--input-fg) !important;
    border: 1px solid var(--input-bd) !important;
}

.ts-dropdown .option {
    background: var(--input-bg) !important;
    color: var(--input-fg) !important;
}

.ts-wrapper.single .ts-control {
    border-radius: 10px;
    box-shadow: none !important;
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    min-height: 42px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.ts-dropdown {
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 5px 0 0;
}

.ts-dropdown .option.active,
.ts-dropdown .option:hover,
.ts-dropdown .option.selected.active {
    background-color: var(--focus) !important;
    color: #fff !important;
}

.ts-wrapper.single .ts-control input {
    color: var(--input-fg) !important;
    line-height: 1.2;
    min-width: 2ch;
    white-space: nowrap;
}

/* Fix for placeholder */
.ts-wrapper.single .ts-control .item {
    color: var(--input-fg) !important;
    white-space: nowrap;
}

/* Fix for create option */
.ts-dropdown .create {
    color: var(--input-fg) !important;
    background: var(--input-bg) !important;
}
