/* ==== AIA AREA SOCI - FOGLIO DI STILE ==== */

/* Variabili CSS */
:root {
    --primary: #097bc0;
    --primary-dark: #0a5a8a;
    --secondary: #2b4a72;
    --accent: #4fc3f7;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #fafbfc;
    --white: #ffffff;
    --text-dark: #1a2332;
    --text-light: #64748b;
    --border: #e2e8f0;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-light: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    /* Safe area support for modern devices */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.hidden {
    display: none !important;
}

/* Skip link per accessibilità */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 8px 8px;
    z-index: 1001;
}

.skip-link:focus {
    top: 0;
}

/* ==== HEADER PRINCIPALE ==== */
header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: var(--transition);
    /* Safe area per notch */
    padding-top: env(safe-area-inset-top);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    height: 45px;
    transition: var(--transition);
}

/* Menu Desktop */
.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
    font-size: 1rem;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.cta-nav {
    background: var(--gradient);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow);
    white-space: nowrap;
    font-size: 1rem;
}

.cta-nav:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}


/* Mobile Menu Button */
        .mobile-menu-btn {
            display: none;
            background: none;
            border: none;
            font-size: clamp(1.2rem, 4vw, 1.5rem);
            color: var(--text-dark);
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 8px;
            transition: var(--transition);
        }

        .mobile-menu-btn:hover {
            background: rgba(0,0,0,0.05);
        }

        .cta-nav {
            background: var(--gradient);
            color: white;
            padding: clamp(0.6rem, 1.5vw, 0.75rem) clamp(1rem, 2.5vw, 1.5rem);
            border-radius: var(--radius);
            text-decoration: none;
            font-weight: 600;
            transition: var(--transition);
            box-shadow: var(--shadow);
            white-space: nowrap;
            font-size: clamp(0.85rem, 1.8vw, 1rem);
        }

        .cta-nav:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }


/* Main Content Area */
.main-content {
    min-height: 100vh;
    padding-top: 80px;
}

.page-header {
    background: var(--gradient);
    color: white;
    padding: 4rem 1.5rem;
    text-align: center;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Container generico */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Section generica */
.section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* ==== MAIN WRAPPER ==== */
.main-wrapper {
    flex: 1;
    margin-top: 80px;
    display: flex;
    flex-direction: column;
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ==== LOADING SPINNER ==== */
.login-container {
    flex: 1;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==== LOGIN SECTION ==== */
.login-container {
    min-height: calc(100vh - 160px);
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.login-container::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 1000 1000"><defs><pattern id="grid" width="50" height="50" patternUnits="userSpaceOnUse"><path d="M 50 0 L 0 0 0 50" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

/* Mobile-first floating patterns */
@media (max-width: 768px) {
    .login-container::after {
        content: '';
        position: absolute;
        width: 200px;
        height: 200px;
        background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
        border-radius: 50%;
        top: -100px;
        right: -50px;
        animation: floatPattern 20s ease-in-out infinite;
    }
}

@keyframes floatPattern {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-30px, 30px) scale(1.1); }
    66% { transform: translate(30px, -20px) scale(0.9); }
}

.login-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 4rem;
    max-width: 1200px;
    width: 100%;
    align-items: start;
    position: relative;
    z-index: 1;
}

.login-hero {
    color: white;
}

.login-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw + 1rem, 3.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    animation: fadeInUp 0.8s ease-out;
}

.login-hero p {
    font-size: clamp(1rem, 2vw + 0.5rem, 1.3rem);
    margin-bottom: 3rem;
    opacity: 0.9;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.hero-features {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.hero-feature {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
}

.hero-feature:hover {
    background: rgba(255,255,255,0.12);
    transform: translateX(5px);
    border-color: rgba(255,255,255,0.2);
}

.hero-feature-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.15) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.hero-feature:hover .hero-feature-icon {
    transform: rotate(5deg) scale(1.1);
    background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.2) 100%);
}

.hero-feature-text {
    font-weight: 500;
    opacity: 0.95;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.4;
}

.login-box {
    background: white;
    padding: clamp(2rem, 4vw, 3.5rem);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.1);
    position: relative;
    backdrop-filter: blur(20px);
    animation: slideUpScale 0.8s ease-out 0.6s backwards;
    transition: transform 0.3s ease;
}

.login-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.15);
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
    border-radius: 24px 24px 0 0;
    animation: expandWidth 1s ease-out 1s backwards;
}

@keyframes slideUpScale {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes expandWidth {
    from { width: 0; left: 50%; }
    to { width: 100%; left: 0; }
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeIn 0.6s ease-out 0.7s backwards;
}

.login-logo {
    height: clamp(50px, 8vw, 60px);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.login-logo:hover {
    transform: scale(1.05);
}

.login-title {
    font-size: clamp(1.5rem, 3vw, 1.8rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-light);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.4;
}

/* ==== FORM ELEMENTS ==== */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
    animation: fadeIn 0.5s ease-out backwards;
}

.form-group:nth-child(1) { animation-delay: 0.8s; }
.form-group:nth-child(2) { animation-delay: 0.9s; }

.form-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    transition: color 0.3s ease;
}

.form-input {
    width: 100%;
    padding: clamp(0.9rem, 2vw, 1.2rem) clamp(1rem, 2vw, 1.2rem);
    border: 2px solid var(--border);
    border-radius: 14px;
    font-size: clamp(0.95rem, 2vw, 1rem);
    transition: all 0.3s ease;
    background: var(--light);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:hover {
    border-color: rgba(9, 123, 192, 0.3);
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(9, 123, 192, 0.15), 0 4px 12px rgba(9, 123, 192, 0.1);
    background: white;
    transform: translateY(-1px);
}

.form-input::placeholder {
    color: rgba(100, 116, 139, 0.6);
    transition: opacity 0.3s ease;
}

.form-input:focus::placeholder {
    opacity: 0.3;
}

/* ==== BUTTONS ==== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    width: 100%;
    padding: clamp(1rem, 2.5vw, 1.3rem);
    font-size: clamp(1rem, 2vw, 1.1rem);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out 1s backwards;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(9, 123, 192, 0.3), 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    transition: left 0.3s ease;
    z-index: -1;
}

.btn-secondary:hover {
    color: white;
    transform: translateY(-2px);
    border-color: var(--primary-dark);
    box-shadow: 0 8px 16px rgba(9, 123, 192, 0.2);
}

.btn-secondary:hover::before {
    left: 0;
}

.btn-secondary:active {
    transform: translateY(0);
}

/* ==== ALERTS ==== */
.alert {
    padding: clamp(0.85rem, 2vw, 1.2rem);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: clamp(0.85rem, 1.5vw, 0.9rem);
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-error::before {
    background: #ef4444;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-success::before {
    background: #10b981;
}

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

.login-support {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    animation: fadeIn 0.5s ease-out 1.1s backwards;
}

.support-text {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: clamp(0.85rem, 1.5vw, 0.9rem);
    line-height: 1.5;
}

/* ==== MEMBERS DASHBOARD ==== */
.members-section {
    background: var(--light);
    flex: 1;
    display: flex;
    flex-direction: column;
}

footer {
    margin-top: auto;
}

/* Hero Dashboard */
.dashboard-hero {
    background: var(--gradient);
    color: white;
    padding: 4rem 1.5rem 3rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.dashboard-hero::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 1000 1000"><defs><pattern id="grid" width="50" height="50" patternUnits="userSpaceOnUse"><path d="M 50 0 L 0 0 0 50" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.2;
}

.dashboard-hero-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: center;
    position: relative;
    z-index: 1;
    gap: 2rem;
}

.hero-welcome {
    flex: 1;
}

.hero-welcome h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.hero-welcome p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.hero-stats {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-stat {
    text-align: center;
    min-width: 80px;
}

.hero-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.hero-stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.user-card {
    background: rgba(255,255,255,0.15);
    padding: 1.5rem;
    border-radius: 16px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
    text-align: center;
    justify-self: center;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0 auto 1rem auto;
    box-shadow: var(--shadow);
}

.user-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.user-role {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* ==== DASHBOARD LAYOUT ==== */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    flex: 1;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(250px, 300px) 1fr;
    gap: 3rem;
}

/* ==== SIDEBAR ==== */
.sidebar {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    height: fit-content;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: calc(80px + 2rem);
    border: 1px solid var(--border);
}

.sidebar-header {
    margin-bottom: 2rem;
    text-align: center;
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin: 0 auto 1rem auto;
}

.sidebar-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.sidebar-subtitle {
    font-size: 0.85rem;
    color: var(--text-light);
}

.nav-section {
    margin-bottom: 2.5rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    padding-left: 1rem;
}

.nav-menu-sidebar {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link-sidebar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-link-sidebar:hover,
.nav-link-sidebar.active {
    background: var(--gradient-light);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-link-sidebar.active {
    background: var(--gradient);
    color: white;
    box-shadow: var(--shadow);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* ==== MAIN CONTENT AREA ==== */
.main-content {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.page-header {
    background: var(--gradient-light);
    padding: 3rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.page-content {
    padding: 3rem;
}

/* ==== DASHBOARD CARDS ==== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.dashboard-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

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

.dashboard-card:hover::before {
    transform: translateX(0);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.card-title {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.2rem;
    line-height: 1.3;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.card-content {
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.card-action {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.card-btn {
    width: 100%;
    justify-content: center;
}

/* ==== RESOURCES GRID ==== */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.resource-item {
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.resource-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.resource-item:hover {
    background: white;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.resource-item:hover::before {
    transform: translateX(0);
}

.resource-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.resource-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    flex-shrink: 0;
}

.resource-info h4 {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
    font-size: 1.1rem;
}

.resource-info p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.4;
}

.resource-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.resource-status {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #d1fae5;
    color: #065f46;
}

.resource-link {
    color: var(--text-light);
    font-size: 0.8rem;
    text-decoration: none;
}

/* ==== STATI RISORSE ==== */
.resource-placeholder {
    opacity: 0.8;
    cursor: default;
}

.resource-placeholder:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.resource-category {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--gradient-light);
    color: var(--primary);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.status-available {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.resource-status {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.resource-status i {
    font-size: 0.7rem;
}

/* ==== CONTENT SECTIONS ==== */
.content-section {
    background: white;
    border-radius: 16px;
    border: 2px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.section-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.section-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.3rem;
}

/* ==== FORM MODERNA ==== */
.form-modern {
    display: grid;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-control label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.form-control input,
.form-control select,
.form-control textarea {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control input:focus,
.form-control select:focus,
.form-control textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(9, 123, 192, 0.1);
}

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

/* ==== MODAL ==== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 41, 59, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transform: translateY(30px) scale(0.95);
    transition: var(--transition);
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    background: var(--gradient-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(0,0,0,0.1);
    color: var(--text-dark);
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* ==== NOTIFICATION PANEL ==== */
.notification-panel {
    background: var(--gradient-light);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
}

.notification-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.notification-icon {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.notification-title {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2rem;
}

.notification-content {
    color: var(--text-light);
    line-height: 1.6;
}

/* ==== TEMPLATE CATEGORIES MIGLIORATE ==== */
.template-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.template-category {
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.template-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.template-category:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.template-category:hover::before {
    transform: translateX(0);
}

.template-category.active {
    background: var(--gradient-light);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.template-category.active::before {
    transform: translateX(0);
}

.template-category-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    margin: 0 auto 1.2rem auto;
    box-shadow: var(--shadow);
}

.template-category h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.template-category span {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ==== TEMPLATE GALLERY MIGLIORATA ==== */
.template-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    padding: 0;
}

.template-item {
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.template-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1;
}

.template-item:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.template-item:hover::before {
    transform: translateX(0);
}

.template-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--light);
    position: relative;
    cursor: pointer;
}

.template-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.template-item:hover .template-image img {
    transform: scale(1.05);
}

/* ==== TEMPLATE PREVIEW OVERLAY ==== */
.template-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 123, 192, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.template-image:hover .template-preview-overlay {
    opacity: 1;
}

.template-preview-overlay i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.template-preview-overlay span {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.template-info {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.template-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.8rem;
    line-height: 1.3;
}

.template-info p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex: 1;
}

.template-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
}

.template-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.template-btn:active {
    transform: translateY(0);
}

/* ==== SEZIONE "COME FUNZIONA" MIGLIORATA ==== */
.how-it-works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.how-it-works-step {
    text-align: center;
    padding: 2rem 1.5rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.how-it-works-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.how-it-works-step:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.how-it-works-step:hover::before {
    transform: translateX(0);
}

.step-number {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: var(--shadow);
}

.step-number.step-1 {
    background: var(--primary);
}

.step-number.step-2 {
    background: var(--success);
}

.step-number.step-3 {
    background: var(--accent);
}

.how-it-works-step h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.8rem;
    line-height: 1.2;
}

.how-it-works-step p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

/* ==== TEMPLATE PREVIEW MODAL MIGLIORATO ==== */
.template-preview-modal {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px;
    box-sizing: border-box;
}

.template-preview-content {
    background: white;
    border-radius: 24px;
    max-width: 1200px;
    max-height: 700px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(30px) scale(0.95);
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

.template-preview-modal.show .template-preview-content {
    transform: translateY(0) scale(1);
}

.template-preview-header {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.template-preview-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    color: var(--text-dark);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.template-preview-close:hover {
    background: white;
    transform: scale(1.1);
    color: var(--danger);
}

.template-preview-body {
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    height: 100%;
    overflow: hidden;
}

.template-preview-image {
    background: var(--light);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px 0 0 24px;
    padding: 20px;
    box-sizing: border-box;
}

.template-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: zoom-in;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.template-preview-image.zoomed img {
    transform: scale(1.8);
    cursor: zoom-out;
}

.template-preview-overlay {
    position: absolute;
    bottom: 30px;
    right: 30px;
    opacity: 0;
    transition: var(--transition);
}

.template-preview-image:hover .template-preview-overlay {
    opacity: 1;
}

.template-zoom-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(9, 123, 192, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.template-zoom-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.template-preview-info {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0 24px 24px 0;
    overflow: hidden;
    max-height: 100%;
}

.template-preview-info-scrollable {
    padding: 3rem;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.template-preview-info-scrollable::-webkit-scrollbar {
    width: 6px;
}

.template-preview-info-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.template-preview-info-scrollable::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.template-preview-info-scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.template-preview-details h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    line-height: 1.2;
    padding-right: 1rem;
}

.template-preview-details p {
    font-size: 1.05rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.template-preview-features {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.template-feature {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--gradient-light);
    border-radius: 12px;
    border: 1px solid rgba(9, 123, 192, 0.1);
}

.template-feature i {
    color: var(--primary);
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.template-feature span {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.template-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.template-tag {
    padding: 0.4rem 0.8rem;
    background: var(--primary);
    color: white;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.template-tag:nth-child(2) {
    background: var(--success);
}

.template-tag:nth-child(3) {
    background: var(--accent);
}

.template-preview-actions {
    padding: 2rem 3rem;
    border-top: 1px solid var(--border);
    background: var(--light);
    border-radius: 0 0 24px 0;
}

.template-preview-actions .btn {
    width: 100%;
    margin-bottom: 1rem;
}

.template-preview-actions .btn:last-child {
    margin-bottom: 0;
}

.template-request-btn {
    font-size: 1rem;
    padding: 1.1rem 2rem;
    box-shadow: var(--shadow-lg);
}

.template-request-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.template-close-btn {
    padding: 0.9rem 2rem;
    font-size: 0.95rem;
}

/* ==== ANIMAZIONI ==== */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-up {
    animation: slideUp 0.6s ease-out;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Touch feedback per mobile */
@media (hover: none) and (pointer: coarse) {
    .btn:active,
    .form-input:active,
    .hero-feature:active {
        transform: scale(0.98);
    }
    
    /* Rimuove hover effects su touch devices */
    .hero-feature:hover {
        background: rgba(255,255,255,0.08);
        transform: none;
    }
    
    /* Migliora tap targets */
    .btn,
    .form-input,
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.template-item,
.template-category,
.how-it-works-step {
    animation: slideInUp 0.6s ease-out;
}

.template-item:nth-child(even) {
    animation-delay: 0.1s;
}

.template-category:nth-child(2) {
    animation-delay: 0.1s;
}

.template-category:nth-child(3) {
    animation-delay: 0.2s;
}

.template-category:nth-child(4) {
    animation-delay: 0.3s;
}

.how-it-works-step:nth-child(2) {
    animation-delay: 0.2s;
}

.how-it-works-step:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==== FOCUS STATES ==== */
.btn:focus,
.form-input:focus,
.nav-link-sidebar:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==== LOADING STATES ==== */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Footer */
footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 1.5rem 1rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--accent);
    font-size: 1.2rem;
}

.footer-section a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: var(--transition);
    font-size: 1rem;
}

.footer-section a:hover {
    opacity: 1;
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 2rem;
    padding-top: 1rem;
    text-align: center;
    opacity: 0.6;
    font-size: 0.9rem;
}


 /* Responsive */
        @media (max-width: 768px) {
            .mobile-menu-btn {
                display: block;
            }

            .nav-container {
                flex-direction: column;
                align-items: flex-start;
                gap: 0.75rem;
            }

            .logo {
                height: 38px;
            }

            .nav-menu {
                display: flex;
                position: static;
                background: transparent;
                flex-direction: row;
                flex-wrap: wrap;
                gap: 0.75rem 1rem;
                padding: 0;
                box-shadow: none;
                border-top: none;
            }

            .cta-nav {
                display: inline-flex;
            }

            .cta-nav-mobile {
                display: block !important;
                background: var(--gradient) !important;
                color: white !important;
                padding: 0.75rem 1.5rem !important;
                border-radius: var(--radius) !important;
                margin-top: 0.5rem;
                text-align: center;
            }
        }

        /* Animazioni */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .fade-in {
            animation: fadeInUp 0.6s ease-out;
        }

/* ==== MOBILE FIRST - Login Ottimizzato ==== */
@media (max-width: 480px) {
    /* Container principale mobile */
    .login-container {
        padding: 1.5rem 1rem;
        min-height: calc(100vh - 140px);
    }
    
    .login-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        max-width: 100%;
    }
    
    /* Hero section mobile */
    .login-hero {
        text-align: center;
        padding: 0 0.5rem;
    }
    
    .login-hero h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    .login-hero p {
        font-size: 0.95rem;
        margin-bottom: 2rem;
        padding: 0 0.5rem;
    }
    
    /* Features mobile - layout a griglia 2x2 */
    .hero-features {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .hero-feature {
        padding: 0.75rem;
        border-radius: 10px;
    }
    
    .hero-feature-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    
    .hero-feature-text {
        font-size: 0.85rem;
    }
    
    /* Login box mobile */
    .login-box {
        padding: 1.75rem 1.25rem;
        border-radius: 20px;
        margin: 0 -0.25rem;
        box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    }
    
    .login-header {
        margin-bottom: 2rem;
    }
    
    .login-logo {
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.9rem;
    }
    
    /* Form mobile */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .form-label i {
        font-size: 0.9rem;
        margin-right: 0.4rem !important;
    }
    
    .form-input {
        padding: 0.9rem 1rem;
        font-size: 16px; /* Previene zoom su iOS */
        border-radius: 12px;
    }
    
    /* Buttons mobile */
    .btn-primary {
        padding: 1rem;
        font-size: 0.95rem;
        border-radius: 12px;
    }
    
    .btn-secondary {
        padding: 0.85rem 1.25rem;
        font-size: 0.9rem;
    }
    
    /* Support section mobile */
    .login-support {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    .support-text {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
}

@media (min-width: 481px) and (max-width: 600px) {
    .login-container { padding: 2rem 1rem; }
    .login-content { 
        grid-template-columns: 1fr; 
        gap: 2.5rem;
        max-width: 500px;
    }
    .login-hero h1 { font-size: 2rem; }
    .login-hero p { font-size: 1rem; margin-bottom: 2rem; }
    .hero-features { gap: 0.85rem; }
    .login-box { padding: 2rem 1.5rem; }
    .form-input { font-size: 16px; }
    
    /* Template categoria logo (biglietti da visita) */
    .template-item.logo .template-image { height: 160px; }
}

@media (min-width: 601px) and (max-width: 767px) {
    .login-content { 
        gap: 2.5rem;
        grid-template-columns: 1fr;
        max-width: 600px;
    }
    .login-hero h1 { font-size: 2.25rem; }
    .login-box { padding: 2.5rem 2rem; }
    .hero-features {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .template-item.logo .template-image { height: 180px; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .login-content {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        align-items: center;
    }
    .login-hero h1 { font-size: 2.5rem; }
    .hero-features {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .login-box { padding: 2.5rem; }
}

@media (min-width: 992px) {
    .hero-features {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .login-container { padding: 4rem 3rem; }
    .login-content { gap: 5rem; }
    .login-hero { max-width: 560px; }
}

/* ==== Mobile-first layout adaptations (no content hidden; desktop unchanged) ==== */
@media (max-width: 600px) {
    /* Stack sidebar and main like the example's menu/main areas */
    .dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            'menu'
            'main';
        gap: 1.5rem;
    }

    .sidebar {
        grid-area: menu;
        position: static;
        top: auto;
    }

    .main-content {
        grid-area: main;
    }

    /* Prevent horizontal overflow from min column widths */
    .dashboard-grid,
    .resources-grid,
    .template-gallery,
    .template-categories-grid,
    .how-it-works-grid {
        grid-template-columns: 1fr !important;
    }

    /* Override inline grid columns in specific pages */
    #templates-page .dashboard-grid { grid-template-columns: 1fr !important; }
    #profile-page .dashboard-grid { grid-template-columns: 1fr !important; }

    .dashboard-hero-content { grid-template-columns: 1fr; }

    .page-content { padding: 1.25rem; }
    .page-header { padding: 2rem 1.25rem; }
    .page-title { font-size: 1.8rem; }
    .login-hero h1 { font-size: 2.2rem; }

    /* Template preview modal: single column on small screens */
    .template-preview-body { grid-template-columns: 1fr; }
    .template-preview-image { border-radius: 24px 24px 0 0; }
    .template-preview-info { border-radius: 0 0 24px 24px; }
}

@media (min-width: 600px) and (max-width: 767px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            'menu'
            'main';
        gap: 2rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Keep two columns, optimize spacing */
    .dashboard-layout {
        grid-template-columns: minmax(220px, 260px) 1fr;
        gap: 2rem;
    }
}

/* ==== MOBILE NAV - HEIGHT REDUCTION (Area Soci) ==== */
@media (max-width: 768px) {
    .site-header .nav-container {
        padding: 0.5rem 1rem;
        gap: 0.35rem;
    }

    .site-header .logo {
        height: 34px;
    }

    .site-header .nav-menu {
        gap: 0.5rem 0.75rem;
    }

    .site-header .nav-link {
        font-size: 0.9rem;
        padding: 0.3rem 0;
    }

    /* In caso di CTA nel nav mobile, riduci dimensioni conservando la gerarchia visiva */
    .site-header .cta-nav,
    .site-header .cta-nav-mobile {
        font-size: 0.85rem !important;
        padding: 0.5rem 1rem !important;
    }
}

@media (max-width: 480px) {
    .site-header .nav-container {
        padding: 0.4rem 0.75rem;
        gap: 0.25rem;
    }

    .site-header .logo {
        height: 32px;
    }

    .site-header .nav-link {
        font-size: 0.85rem;
    }

    .site-header .cta-nav,
    .site-header .cta-nav-mobile {
        font-size: 0.8rem !important;
        padding: 0.45rem 0.9rem !important;
    }
}
