/* ==========================================================================
   SOLON — Design System & Global Styles
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
    /* --- Palette Solon --- */
    --primary:        #1a6cf5;     /* Blu europeo vibrante */
    --primary-dark:   #0f4dbf;
    --primary-light:  #e8f0fe;

    --gold:           #c9a227;     /* Accent dorato */
    --gold-light:     #f5e6a3;

    /* --- Sfondi --- */
    --bg-page:        #0d1117;     /* Nero inchiostro */
    --bg-surface:     #161b22;     /* Card principale */
    --bg-elevated:    #1c2330;     /* Card elevated */
    --bg-overlay:     rgba(22, 27, 34, 0.95);

    /* --- Testi --- */
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;
    --text-link:      #58a6ff;

    /* --- Bordi --- */
    --border:         #30363d;
    --border-light:   #21262d;
    --border-focus:   var(--primary);

    /* --- Stati --- */
    --success:        #3fb950;
    --error:          #f85149;
    --warning:        #d29922;
    --info:           #58a6ff;

    /* --- Expert badge --- */
    --expert-color:   #c9a227;
    --expert-bg:      rgba(201, 162, 39, 0.12);

    /* --- Shadows --- */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 20px rgba(26, 108, 245, 0.15);

    /* --- Radii --- */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-pill: 50px;

    /* --- Transizioni --- */
    --transition: 0.2s ease;
    --transition-slow: 0.4s ease;

    /* --- Z-index layers --- */
    --z-base:    1;
    --z-nav:     100;
    --z-overlay: 500;
    --z-toast:   1000;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--text-link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }

img { max-width: 100%; display: block; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding-bottom: 80px; /* spazio per bottom nav mobile */
}

.container-solon {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px;
}

.container-wide {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.solon-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.solon-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-glow);
}

.solon-card-elevated {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn-solon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    outline: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26, 108, 245, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background: var(--primary-light);
    color: var(--primary);
}

.btn-gold {
    background: var(--gold);
    color: #0d1117;
}
.btn-gold:hover {
    background: #b8911f;
    transform: translateY(-1px);
}

.btn-danger {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
}
.btn-danger:hover {
    background: var(--error);
    color: #fff;
}

.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* Stato disabilitato */
.btn-solon:disabled, .btn-solon.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */

.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 108, 245, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--error);
    margin-top: 0.3rem;
}

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */

.badge-solon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-expert {
    background: var(--expert-bg);
    color: var(--expert-color);
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.badge-standard {
    background: rgba(139, 148, 158, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.badge-pending {
    background: rgba(210, 153, 34, 0.15);
    color: var(--warning);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

/* ==========================================================================
   AVATAR
   ========================================================================== */

.avatar {
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-elevated);
    flex-shrink: 0;
}

.avatar-sm  { width: 32px;  height: 32px; }
.avatar-md  { width: 42px;  height: 42px; }
.avatar-lg  { width: 64px;  height: 64px; }
.avatar-xl  { width: 96px;  height: 96px; }

.avatar-placeholder {
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ==========================================================================
   ALERT / TOAST
   ========================================================================== */

.alert-solon {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid transparent;
    animation: fadeIn 0.3s ease;
}

.alert-success { background: rgba(63, 185, 80, 0.1); border-color: rgba(63, 185, 80, 0.3); color: var(--success); }
.alert-error   { background: rgba(248, 81, 73, 0.1);  border-color: rgba(248, 81, 73, 0.3);  color: var(--error); }
.alert-warning { background: rgba(210, 153, 34, 0.1); border-color: rgba(210, 153, 34, 0.3); color: var(--warning); }
.alert-info    { background: rgba(88, 166, 255, 0.1); border-color: rgba(88, 166, 255, 0.3); color: var(--info); }

/* Toast (fixed) */
.toast-container {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    min-width: 280px;
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
}

/* ==========================================================================
   SCORE CHIPS
   ========================================================================== */

.score-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
}

.score-interaction {
    background: rgba(26, 108, 245, 0.1);
    color: var(--primary);
    border: 1px solid rgba(26, 108, 245, 0.2);
}

.score-reputation {
    background: var(--expert-bg);
    color: var(--gold);
    border: 1px solid rgba(201, 162, 39, 0.2);
}

/* ==========================================================================
   DIVIDERS
   ========================================================================== */

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ==========================================================================
   SKELETON LOADER
   ========================================================================== */

.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   KEYFRAMES
   ========================================================================== */

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

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

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

@keyframes shimmer {
    to { background-position: -200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==========================================================================
   UTILITY
   ========================================================================== */

.text-primary-solon  { color: var(--primary); }
.text-gold           { color: var(--gold); }
.text-muted-solon    { color: var(--text-muted); }
.text-secondary-solon{ color: var(--text-secondary); }
.text-success        { color: var(--success); }
.text-error          { color: var(--error); }

.bg-surface  { background: var(--bg-surface); }
.bg-elevated { background: var(--bg-elevated); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-xs  { font-size: 0.75rem; }
.fs-sm  { font-size: 0.875rem; }
.fs-md  { font-size: 1rem; }
.fs-lg  { font-size: 1.125rem; }
.fs-xl  { font-size: 1.5rem; }

.mt-auto { margin-top: auto; }
.d-flex  { display: flex; }
.align-center { align-items: center; }
.gap-1  { gap: 0.5rem; }
.gap-2  { gap: 1rem; }
.justify-between { justify-content: space-between; }
