/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f2f2f2 !important;
    color: #111111;
    min-height: 100vh;
    overflow: auto;
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f2f2f2;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: -1;
}

/* Container login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
}

/* Card login con effetto vetro */
.login-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 122, 61, 0.3);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    color: white;
    margin-bottom: 5px;
    font-weight: 500;
}

.login-body,
.login-body h1,
.login-body label,
.login-body input,
.login-body select,
.login-body textarea,
.login-body .ios-switch-wrap,
.login-body .error-message {
    color: #111111;
}

.login-body h1 {
    text-shadow: none;
}

.login-body input::placeholder {
    color: #111111;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 10px;
    background: rgba(165, 214, 167, 0.3);
    color: #1b3e1c;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* Pulsanti generici */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
        background: linear-gradient(135deg, #007A3D, #aeea00);
        color: #1b3e1c;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    opacity: .95;
}

.btn.secondary {
    background: rgba(255,255,255,0.2);
    color: white;
}

.btn.secondary:hover {
    background: rgba(255,255,255,0.3);
}

/* Select2 custom style */
.select2-container--classic .select2-selection--single {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: white;
    min-height: 44px;
    height: auto;
    transition: all 0.3s ease;
}
.select2-container--classic .select2-selection--single .select2-selection__rendered {
    color: white;
    line-height: 26px;
}
.select2-container--classic .select2-selection--single .select2-selection__arrow {
    height: 34px;
    right: 10px;
}
.select2-dropdown {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
}
.select2-results__option {
    color: white;
    padding: 8px 12px;
}
.select2-results__option--highlighted {
    background: rgba(255,255,255,0.15);
    color: white;
}

input::placeholder, select {
    color: rgba(27, 62, 28, 0.7);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    color: white;
    margin-top: 15px;
}

table th, table td {
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(165, 214, 167, 0.2);
    text-align: left;
    vertical-align: middle;
}

table th {
    background: rgba(0, 122, 61, 0.3);
    font-weight: 700;
}

table tr:nth-child(even) td {
    background: rgba(165, 214, 167, 0.15);
}

.message,
.error {
    display: none;
}

input:focus, select:focus {
    outline: none;
    background: rgba(165, 214, 167, 0.4);
    box-shadow: 0 0 0 2px rgba(0, 122, 61, 0.5);
}

.login-btn {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #0f7e42;
    border-radius: 30px;
    background: #0f7e42;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(15, 126, 66, 0.25);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.login-btn:hover {
    background: #0b6535;
    border-color: #0b6535;
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 24px rgba(15, 126, 66, 0.35);
}

.login-btn:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 5px 14px rgba(15, 126, 66, 0.28);
}

/* Tema chiaro condiviso */
body,
body h1,
body h2,
body h3,
body h4,
body h5,
body h6,
body p,
body span,
body strong,
body label,
body small,
body div,
body td,
body th,
body li,
body a:not(.btn):not(.btn-glass):not(.login-btn):not(.back-btn):not(.menu-button):not(.logout-btn):not(.icon-btn),
body input,
body select,
body textarea {
    color: #111111 !important;
}

body::before {
    display: none;
}

.container,
.settings-container,
.login-card,
.card,
.formula-editor,
.formula-questions,
.question-step-mode .question-row.wizard-active,
.switch-group,
.quick-divider-form,
.partner-header,
.partner-item,
.profile-dialog,
.table-wrap,
.esg-summary .row,
.question-step-mode .note-cell,
.question-step-mode .indications-cell {
    background: rgba(255, 255, 255, 0.72) !important;
    border-color: rgba(17, 17, 17, 0.12) !important;
    box-shadow: 0 10px 28px rgba(17, 17, 17, 0.08) !important;
}

.login-card::before {
    display: none;
}

.container {
    padding: 25px;
    border: 1px solid rgba(17, 17, 17, 0.12);
    border-radius: 18px;
}

.policy-container {
    width: min(980px, calc(100% - 32px));
    margin: 32px auto;
    padding: 28px;
    background: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.12);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(17, 17, 17, 0.08);
}

.policy-container h1,
.policy-container h2 {
    text-align: left;
    text-shadow: none;
}

.policy-container h1 {
    margin: 18px 0 20px;
}

.policy-container h2 {
    margin: 26px 0 10px;
    font-size: 1.25rem;
}

.policy-container p,
.policy-container li {
    line-height: 1.6;
}

.policy-container ul {
    padding-left: 22px;
}

.policy-container table {
    border-collapse: collapse;
    border-spacing: 0;
    min-width: 720px;
}

.login-policy-links {
    margin-top: 18px;
    text-align: center;
    font-size: 0.9rem;
}

.login-policy-links a {
    display: inline-block;
    margin: 4px 6px;
    font-weight: 700;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    border-radius: 8px;
    background: transparent !important;
    color: #111111 !important;
    box-shadow: none !important;
    cursor: pointer;
    padding: 0;
}

.password-toggle:hover {
    background: rgba(17, 17, 17, 0.08) !important;
    border-color: transparent !important;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    pointer-events: none;
}

input,
select,
textarea,
.answer-control,
.formula-number-input,
.formula-display {
    background: #ffffff !important;
    border: 1px solid rgba(17, 17, 17, 0.16) !important;
    color: #111111 !important;
}

input::placeholder,
textarea::placeholder {
    color: rgba(17, 17, 17, 0.62) !important;
}

input:focus,
select:focus,
textarea:focus,
.answer-control:focus {
    background: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(15, 126, 66, 0.28) !important;
}

table,
table th,
table td {
    color: #111111 !important;
}

table th,
th {
    background: rgba(15, 126, 66, 0.14) !important;
}

table td,
.question-row td,
.impact-row td,
.divider-row td,
.threshold-json,
.formula-question-item {
    background-color: rgba(255, 255, 255, 0.78) !important;
    border-color: rgba(17, 17, 17, 0.12) !important;
}

.message,
.error {
    display: block;
}

.btn,
.btn-glass,
.login-btn,
.back-btn,
.logout-btn,
.icon-btn,
.placeholder-btn,
.view-toggle-btn,
button,
button[type="submit"],
button[type="button"] {
    background: #0f7e42 !important;
    border: 1px solid #0f7e42 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(15, 126, 66, 0.22) !important;
}

.btn *,
.btn-glass *,
.login-btn *,
.back-btn *,
.logout-btn *,
.icon-btn *,
.placeholder-btn *,
.view-toggle-btn *,
button *,
button[type="submit"] *,
button[type="button"] * {
    color: #ffffff !important;
}

.btn:hover,
.btn-glass:hover,
.login-btn:hover,
.back-btn:hover,
.logout-btn:hover,
.icon-btn:hover,
.placeholder-btn:hover,
.view-toggle-btn:hover,
button:hover,
button[type="submit"]:hover,
button[type="button"]:hover {
    background: #0b6535 !important;
    border-color: #0b6535 !important;
}

.back-btn,
.logout-btn,
.delete-btn,
#profile-cancel,
.btn.secondary,
a.btn[href*="_delete.php"],
a.btn[href*="action=delete"] {
    background: #111111 !important;
    border-color: #111111 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px rgba(17, 17, 17, 0.2) !important;
}

.back-btn:hover,
.logout-btn:hover,
.delete-btn:hover,
#profile-cancel:hover,
.btn.secondary:hover,
a.btn[href*="_delete.php"]:hover,
a.btn[href*="action=delete"]:hover {
    background: #111111 !important;
    border-color: #111111 !important;
}

.menu-button {
    background: #0f7e42 !important;
    border-color: #0f7e42 !important;
    color: #ffffff !important;
}

.menu-button,
.menu-button * {
    color: #ffffff !important;
}

.menu-button:hover {
    background: #0070b5 !important;
    border-color: #0070b5 !important;
}

.dashboard .partner-header {
    background: #ffffff !important;
}

.dashboard .partner-item {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.esg-summary {
    background: rgba(255, 255, 255, 0.86) !important;
    border-color: rgba(17, 17, 17, 0.12) !important;
    box-shadow: 0 10px 28px rgba(17, 17, 17, 0.08) !important;
}

.esg-summary,
.esg-summary *,
.totals,
.unit-suffix,
.multi-answer-option,
.wizard-progress,
.current-impact-badge,
.question-step-mode .question-cell::before,
.question-step-mode .note-cell::before,
.question-step-mode .indications-cell::before,
.question-step-mode .answer-cell::before {
    color: #111111 !important;
}

.esg-summary .summary-extra {
    display: none !important;
}

.crif-e,
.crif-a {
    color: #ffffff !important;
}

.login-brand-box {
    padding: 0;
    margin-bottom: 20px;
    text-align: center;
}

.login-brand-box img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    max-height: 140px;
}

.btn-glass {
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.42);
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.btn-glass:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.28);
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: rgba(0, 122, 61, 0.8);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.formula-editor {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
}

.formula-display {
    background: rgba(165, 214, 167, 0.2);
    border: none;
    border-radius: 8px;
    padding: 10px;
    color: #1b3e1c;
    font-family: monospace;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 10px;
    min-height: 40px;
}

.formula-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.formula-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    padding: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.formula-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.formula-number-input {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(165, 214, 167, 0.2);
    color: #1b3e1c;
    margin-bottom: 10px;
}

.formula-questions {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.formula-question-item {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 5px;
    cursor: pointer;
    color: #1b3e1c;
    transition: all 0.2s ease;
}

.formula-question-item:hover {
    background: rgba(255, 255, 255, 0.3);
}

.error-message {
    color: #d32f2f;
    text-align: center;
    margin-top: 15px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 480px) {
    .login-card {
        margin: 20px;
        padding: 30px 20px;
    }
}
