/* ========================================
   RICETTIVA AI - Stile Globale
   ======================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #0f172a;
    --accent: #f59e0b;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* --- Navbar --- */
.navbar { background: white; border-bottom: 1px solid var(--gray-200); padding: 16px 0; position: sticky; top: 0; z-index: 100; }
.navbar .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.25rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--gray-600); font-weight: 500; font-size: 0.9rem; }
.nav-links a:hover { color: var(--primary); }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius);
    font-weight: 500; font-size: 0.9rem; text-decoration: none;
    cursor: pointer; border: none; transition: all 0.2s; font-family: var(--font);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Hero --- */
.hero { padding: 80px 0; background: linear-gradient(135deg, var(--secondary) 0%, #1e3a5f 100%); color: white; text-align: center; }
.hero h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 20px; }
.hero .highlight { color: var(--accent); }
.hero-subtitle { font-size: 1.2rem; color: var(--gray-300); margin-bottom: 32px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* --- Sections --- */
.section { padding: 64px 0; }
.section-alt { background: white; }
.section-title { font-size: 1.8rem; font-weight: 700; text-align: center; margin-bottom: 48px; color: var(--secondary); }

/* --- Grids --- */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.step-card { background: white; padding: 32px; border-radius: var(--radius-lg); box-shadow: var(--shadow); text-align: center; }
.step-number { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; margin: 0 auto 16px; }
.step-card h3 { font-size: 1.1rem; margin-bottom: 12px; }
.step-card p { color: var(--gray-500); font-size: 0.9rem; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.feature-card { padding: 24px; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); background: var(--gray-50); }
.feature-card h3 { font-size: 1rem; margin-bottom: 8px; }
.feature-card p { color: var(--gray-500); font-size: 0.9rem; }

/* --- Auth --- */
.auth-container { display: flex; justify-content: center; padding: 60px 24px; }
.auth-card { background: white; padding: 40px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: 100%; max-width: 420px; }
.auth-card h2 { margin-bottom: 24px; font-size: 1.4rem; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-link { text-align: center; font-size: 0.85rem; color: var(--gray-500); }
.auth-link a { color: var(--primary); text-decoration: none; }

/* --- Forms --- */
.form-layout { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 500; font-size: 0.9rem; color: var(--gray-700); }
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 0.9rem; font-family: var(--font); transition: border-color 0.2s; background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.8rem; color: var(--gray-500); }
.form-hint code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; }
.form-actions { display: flex; gap: 12px; align-items: center; padding-top: 8px; flex-wrap: wrap; }
.code-textarea { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.85rem; line-height: 1.5; }

/* --- Tables --- */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: var(--gray-50); padding: 12px 16px; text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--gray-200); }
.data-table td { padding: 12px 16px; border-top: 1px solid var(--gray-100); font-size: 0.9rem; }
.data-table tr:hover td { background: var(--gray-50); }

/* --- Badges & Status --- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 500; background: var(--primary-light); color: var(--primary); }
.badge-admin { background: var(--accent); color: var(--secondary); font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }
.status-active { color: var(--success); font-weight: 600; }
.status-inactive { color: var(--gray-400); font-weight: 500; }

/* --- Stats --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: white; padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--secondary); }
.stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }

/* --- Flash Messages --- */
.flash-message { padding: 12px 20px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.9rem; animation: flashIn 0.3s ease; }
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.flash-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #93c5fd; }
@keyframes flashIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-state h2 { color: var(--secondary); margin-bottom: 12px; }
.empty-state .btn { margin-top: 20px; }

/* --- Page Actions --- */
.page-actions { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }

/* --- Footer --- */
.site-footer { padding: 32px 0; text-align: center; color: var(--gray-400); font-size: 0.85rem; border-top: 1px solid var(--gray-200); margin-top: 48px; }

/* --- Generation Cards --- */
.generation-card { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.generation-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.generation-content { font-size: 0.9rem; line-height: 1.7; color: var(--gray-700); white-space: pre-wrap; }
.generation-actions { margin-top: 12px; display: flex; gap: 8px; }

/* --- Test Results --- */
.test-result { margin-top: 32px; padding: 24px; border-radius: var(--radius-lg); }
.test-success { background: #d1fae5; border: 1px solid #6ee7b7; }
.test-error { background: #fee2e2; border: 1px solid #fca5a5; }
.result-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--gray-600); margin: 12px 0; padding: 8px 12px; background: rgba(255,255,255,0.5); border-radius: var(--radius); }
.result-output { background: white; padding: 20px; border-radius: var(--radius); margin-top: 12px; font-size: 0.9rem; line-height: 1.7; white-space: pre-wrap; max-height: 600px; overflow-y: auto; }
.result-debug { margin-top: 16px; }
.result-debug summary { cursor: pointer; font-weight: 500; color: var(--gray-600); padding: 8px 0; }
.result-debug pre { background: var(--gray-800); color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; font-size: 0.8rem; margin-top: 8px; white-space: pre-wrap; }

/* --- Version Cards --- */
.version-card { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.version-card h3 { font-size: 1rem; }
.text-muted { color: var(--gray-400); font-weight: 400; }
.version-card pre { background: var(--gray-50); padding: 12px; border-radius: var(--radius); font-size: 0.8rem; overflow-x: auto; margin-top: 8px; white-space: pre-wrap; }

/* --- Property Info --- */
.property-info { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.property-info p { margin-bottom: 4px; font-size: 0.9rem; }

/* --- Questionnaire --- */
.questionnaire-intro { text-align: center; padding: 40px 20px; }
.questionnaire-progress { margin-bottom: 24px; display: flex; align-items: center; gap: 12px; }
.progress-bar { flex: 1; height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.questionnaire-step { background: white; padding: 32px; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.step-description { color: var(--gray-500); margin-bottom: 24px; }

/* --- Nav Separator --- */
.nav-separator { padding: 16px 20px 8px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400); }

/* --- Placeholder --- */
.placeholder-page { text-align: center; padding: 60px; color: var(--gray-500); }

/* --- Pagination --- */
.pagination { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 24px; padding: 16px 0; }
.pagination-info { font-size: 0.85rem; color: var(--gray-500); }

/* --- Loading --- */
.loading { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--gray-300); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-cta { flex-direction: column; align-items: center; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-links { gap: 12px; }
    .result-meta { flex-direction: column; gap: 4px; }
}
