/**
 * Tesi Personalizzate - CSS Comune
 * Stili base per tutto il processo
 */

/* ===== VARIABILI CSS ===== */
:root {
    --at-primary: #00a19a;
    --at-primary-hover: #008580;
    --at-secondary: #646970;
    --at-success: #00a32a;
    --at-error: #d63638;
    --at-warning: #dba617;
    
    --at-border: #dcdcde;
    --at-border-radius: 8px;
    --at-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    
    --at-text-primary: #1d2327;
    --at-text-secondary: #646970;
    --at-bg-light: #f6f7f7;
    
    --at-spacing-xs: 8px;
    --at-spacing-sm: 16px;
    --at-spacing-md: 24px;
    --at-spacing-lg: 32px;
    --at-spacing-xl: 48px;
}

/* ===== RESET E BASE ===== */
.at-step {
    box-sizing: border-box;
}

.at-step *,
.at-step *::before,
.at-step *::after {
    box-sizing: inherit;
}

/* ===== WRAPPER PRINCIPALE ===== */
.at-tesi-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--at-spacing-md);
}

/* Container per layout con sidebar */
.at-tesi-container {
    display: flex;
    gap: var(--at-spacing-lg);
}

/* Main content */
.at-tesi-main {
    flex: 1;
}

/* Se non c'è sidebar, centra il contenuto */
.at-tesi-container:not(:has(.at-price-sidebar)) .at-tesi-main {
    max-width: 800px;
    margin: 0 auto;
}

/* ===== STEP CONTAINER ===== */
.at-step {
    background: #fff;
    border-radius: var(--at-border-radius);
    padding: var(--at-spacing-lg);
    margin-bottom: var(--at-spacing-md);
    box-shadow: var(--at-box-shadow);
}

.at-step.hidden {
    display: none;
}

/* ===== TITOLI ===== */
.at-section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--at-text-primary);
    margin: 0 0 var(--at-spacing-md) 0;
    text-align: center;
}

/* ===== RESUME SECTION ===== */
.at-resume-section {
    margin-bottom: var(--at-spacing-xl);
    text-align: center;
}

.at-resume-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--at-text-primary);
    margin-bottom: var(--at-spacing-md);
}

.at-resume-form {
    display: flex;
    gap: var(--at-spacing-sm);
    max-width: 500px;
    margin: 0 auto var(--at-spacing-md);
}

.at-resume-form .at-input {
    flex: 1;
}

@media (max-width: 576px) {
    .at-resume-form {
        flex-direction: column;
    }
}

.at-divider {
    position: relative;
    text-align: center;
    margin: var(--at-spacing-lg) 0;
}

.at-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--at-border);
}

.at-divider span {
    position: relative;
    display: inline-block;
    padding: 0 var(--at-spacing-md);
    background: #fff;
    color: var(--at-text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== AREA UPLOAD ===== */
.at-upload-area {
    margin-bottom: var(--at-spacing-lg);
}

.at-upload-dropzone {
    border: 2px dashed var(--at-border);
    border-radius: var(--at-border-radius);
    padding: var(--at-spacing-xl);
    text-align: center;
    transition: all 0.3s ease;
    background: var(--at-bg-light);
}

.at-upload-dropzone:hover {
    border-color: var(--at-primary);
    background: #fff;
}

.at-upload-dropzone.dragover {
    border-color: var(--at-primary);
    background: #e6f2ff;
    transform: scale(1.02);
}

.at-upload-dropzone.small {
    padding: var(--at-spacing-md);
}

.at-upload-icon {
    margin-bottom: var(--at-spacing-sm);
    color: var(--at-secondary);
}

.at-upload-icon svg {
    display: inline-block;
}

.at-upload-text {
    font-size: 16px;
    color: var(--at-text-secondary);
    margin-bottom: var(--at-spacing-md);
    line-height: 1.6;
}

/* ===== PROGRESS BAR ===== */
.at-upload-progress {
    margin-top: var(--at-spacing-md);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--at-bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--at-spacing-xs);
}

.progress-fill {
    height: 100%;
    background: var(--at-primary);
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--at-text-secondary);
}

/* ===== UPLOAD RESULT ===== */
.at-upload-result {
    display: flex;
    align-items: center;
    gap: var(--at-spacing-sm);
    padding: var(--at-spacing-sm);
    background: #fff;
    border: 1px solid var(--at-border);
    border-radius: var(--at-border-radius);
    margin-top: var(--at-spacing-md);
}

.result-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.result-icon.success {
    background: #e6f7ea;
    color: var(--at-success);
}

.result-icon.error {
    background: #fce8e8;
    color: var(--at-error);
}

.result-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-text strong {
    color: var(--at-text-primary);
    font-size: 14px;
}

.result-text span {
    color: var(--at-text-secondary);
    font-size: 13px;
}

/* ===== CHOICE CARDS ===== */
.at-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--at-spacing-md);
    margin-bottom: var(--at-spacing-lg);
}

.at-choice-card {
    border: 2px solid var(--at-border);
    border-radius: var(--at-border-radius);
    padding: var(--at-spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.at-choice-card:hover {
    border-color: var(--at-primary);
    transform: translateY(-4px);
    box-shadow: var(--at-box-shadow);
}

.at-choice-card.selected {
    border-color: var(--at-primary);
    background: #e6f2ff;
}

.choice-icon {
    font-size: 48px;
    color: var(--at-primary);
    margin-bottom: var(--at-spacing-sm);
}

.choice-icon .dashicons {
    width: 48px;
    height: 48px;
    font-size: 48px;
}

.choice-icon img {
    max-width: 48px;
    height: auto;
}

.choice-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--at-text-primary);
}

/* ===== TOGGLE ===== */
.at-toggle-wrapper {
    display: flex;
    gap: var(--at-spacing-sm);
    margin-bottom: var(--at-spacing-md);
    justify-content: center;
}

.at-toggle-option {
    flex: 1;
    max-width: 200px;
    border: 2px solid var(--at-border);
    border-radius: var(--at-border-radius);
    padding: var(--at-spacing-sm);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.at-toggle-option:hover {
    border-color: var(--at-primary);
}

.at-toggle-option input[type="radio"] {
    display: none;
}

.at-toggle-option input[type="radio"]:checked + .toggle-label {
    color: var(--at-primary);
}

.at-toggle-option:has(input[type="radio"]:checked) {
    border-color: var(--at-primary);
    background: #e6f2ff;
}

.toggle-label {
    display: block;
    font-weight: 500;
    font-size: 16px;
    color: var(--at-text-secondary);
    transition: color 0.3s ease;
}

/* ===== FORM FIELDS ===== */
.at-form-fields {
    display: flex;
    flex-direction: column;
    gap: var(--at-spacing-md);
    margin-bottom: var(--at-spacing-md);
}

.at-form-field {
    display: flex;
    flex-direction: column;
    gap: var(--at-spacing-xs);
}

.at-form-field label {
    font-weight: 500;
    font-size: 14px;
    color: var(--at-text-primary);
}

.at-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--at-border);
    border-radius: var(--at-border-radius);
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.at-input:focus {
    outline: none;
    border-color: var(--at-primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

/* ===== BUTTONS ===== */
.at-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--at-border-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.at-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.at-btn-primary {
    background: var(--btn-primary-color, var(--at-primary));
    color: #fff;
}

.at-btn-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--btn-primary-color, var(--at-primary)) 85%, black);
    transform: translateY(-2px);
    box-shadow: var(--at-box-shadow);
}

.at-btn-secondary {
    background: var(--btn-secondary-color, var(--at-secondary));
    color: #fff;
}

.at-btn-secondary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--btn-secondary-color, var(--at-secondary)) 85%, black);
    transform: translateY(-2px);
    box-shadow: var(--at-box-shadow);
}

.at-btn-cancel,
.at-btn-danger {
    background: var(--btn-cancel-color, var(--at-error));
    color: #fff;
}

.at-btn-cancel:hover:not(:disabled),
.at-btn-danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--btn-cancel-color, var(--at-error)) 85%, black);
    transform: translateY(-2px);
    box-shadow: var(--at-box-shadow);
}

/* Bottone grande centrato (mobile-first) */
.at-btn-large {
    width: 100%;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    margin-top: var(--at-spacing-md);
}

.at-btn-large .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Desktop: max-width centrato */
@media (min-width: 768px) {
    .at-btn-large {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Container centrato per sezioni */
.at-section-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.at-section-centered .at-section-title {
    margin-bottom: var(--at-spacing-lg);
}

/* ===== UTILITY ===== */
.text-center {
    text-align: center;
}

.mt-md {
    margin-top: var(--at-spacing-md);
}

.mb-md {
    margin-bottom: var(--at-spacing-md);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .at-tesi-wrapper {
        padding: var(--at-spacing-sm);
    }
    
    .at-step {
        padding: var(--at-spacing-md);
    }
    
    .at-choice-grid {
        grid-template-columns: 1fr;
    }
    
    .at-toggle-wrapper {
        flex-direction: column;
    }
    
    .at-toggle-option {
        max-width: 100%;
    }
}
