/**
 * Modern UI - Comune di Elmas
 * Design contemporaneo con glassmorphism e micro-animazioni
 */

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

:root {
    /* Palette moderna */
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #10b981;
    --primary-glow: rgba(5, 150, 105, 0.4);

    --secondary: #0ea5e9;
    --secondary-light: #38bdf8;

    --accent: #f59e0b;
    --accent-light: #fbbf24;

    --bg-gradient-start: #f0fdf4;
    --bg-gradient-end: #ecfeff;
    --bg-dark: #0f172a;
    --bg-card: rgba(255, 255, 255, 0.85);

    --text-dark: #1e293b;
    --text-body: #475569;
    --text-muted: #94a3b8;

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px var(--primary-glow);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    color: var(--text-body);
    line-height: 1.7;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

.text-primary { color: var(--primary) !important; }
.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1rem 0;
    transition: var(--transition-normal);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    font-size: 1.6rem;
}

.nav-link {
    font-weight: 600;
    color: var(--text-body) !important;
    padding: 0.6rem 1.1rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    color: var(--primary) !important;
    background: rgba(5, 150, 105, 0.08);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, #0d9488 40%, var(--secondary) 100%);
    color: white;
    padding: 100px 0 180px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: pulse 8s ease-in-out infinite;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 120px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120'%3E%3Cpath fill='%23f0fdf4' d='M0,60 C240,120 480,0 720,60 C960,120 1200,0 1440,60 L1440,120 L0,120 Z'/%3E%3C/svg%3E") no-repeat bottom center;
    background-size: cover;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(3rem, 10vw, 5.5rem);
    font-weight: 900;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 30px rgba(0,0,0,0.15);
    animation: fadeInUp 0.8s ease;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 500;
    animation: fadeInUp 0.8s ease 0.1s both;
}

.hero-microcopy {
    font-size: 1.05rem;
    opacity: 0.85;
    font-style: italic;
    margin-top: 1.25rem;
    animation: fadeInUp 0.8s ease 0.2s both;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
}

.card-body {
    padding: 2rem;
}

/* Form Card - Main form */
.form-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    margin-top: -120px;
    position: relative;
    z-index: 10;
    border: none;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Form Controls */
.form-control, .form-select {
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-size: 1rem;
    transition: var(--transition-fast);
    background: #f8fafc;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    background: white;
}

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

.form-label {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
}

.form-check-input {
    width: 1.3rem;
    height: 1.3rem;
    border: 2px solid #cbd5e1;
    border-radius: 5px;
    transition: var(--transition-fast);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    padding: 0.9rem 1.85rem;
    font-weight: 700;
    font-size: 1rem;
    transition: var(--transition-fast);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.45);
    color: white;
}

.btn-outline-primary {
    color: var(--primary);
    border: 2px solid var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.3);
}

.btn-lg {
    padding: 1.15rem 2.5rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

/* Section Styling */
.section {
    padding: 100px 0;
    position: relative;
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    position: relative;
    display: inline-block;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 700px;
}

.section-accent {
    background: linear-gradient(180deg, rgba(5, 150, 105, 0.04) 0%, rgba(14, 165, 233, 0.04) 100%);
}

/* Q&A Cards */
.qa-card {
    border: none;
    border-radius: var(--radius-lg);
    background: white;
    position: relative;
    overflow: visible;
}

.qa-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 5px 0 0 5px;
}

.qa-card .question {
    color: var(--text-body);
    font-style: italic;
    position: relative;
    padding-left: 2rem;
    font-size: 1.05rem;
}

.qa-card .question::before {
    content: '\201C';
    position: absolute;
    left: 0;
    top: -12px;
    font-size: 3.5rem;
    color: var(--primary);
    opacity: 0.25;
    font-family: Georgia, serif;
    line-height: 1;
}

.qa-card .answer {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 2px dashed #e2e8f0;
}

/* Program Items */
.program-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
    border: 1px solid #f1f5f9;
}

.program-item:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(5, 150, 105, 0.2);
    transform: translateX(4px);
}

.program-item .badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 0.55rem 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.program-item .title {
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-dark);
}

.program-item .note {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Accordion */
.accordion {
    --bs-accordion-border-color: transparent;
    --bs-accordion-border-radius: var(--radius-lg);
}

.accordion-item {
    border: none;
    margin-bottom: 0.85rem;
    border-radius: var(--radius-lg) !important;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.accordion-button {
    font-weight: 700;
    color: var(--text-dark);
    background: white;
    padding: 1.3rem 1.6rem;
    border-radius: var(--radius-lg) !important;
    font-size: 1.05rem;
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.accordion-button::after {
    background-size: 1.1rem;
    transition: var(--transition-fast);
}

.accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

.accordion-body {
    background: #fafbfc;
    padding: 1.5rem;
}

/* Badges */
.badge {
    font-weight: 700;
    padding: 0.55em 1.1em;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
}

.badge.bg-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
}

.badge.bg-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

.badge.bg-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
}

/* Alerts */
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 1.25rem 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(22, 163, 74, 0.12) 100%);
    color: #166534;
    border-left: 5px solid var(--success);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(220, 38, 38, 0.12) 100%);
    color: #991b1b;
    border-left: 5px solid var(--danger);
}

.alert-info {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(2, 132, 199, 0.12) 100%);
    color: #075985;
    border-left: 5px solid var(--secondary);
}

/* Honeypot */
.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* Footer */
footer {
    background: var(--bg-dark) !important;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
}

/* Admin Styles */
.admin-sidebar {
    background: linear-gradient(180deg, var(--bg-dark) 0%, #1e293b 100%);
    min-height: 100vh;
    padding-top: 1.5rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    margin: 0.3rem 0.75rem;
    transition: var(--transition-fast);
    font-weight: 600;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.25) 0%, rgba(14, 165, 233, 0.15) 100%);
    color: white;
}

.admin-sidebar .nav-link i {
    width: 24px;
}

.stat-card {
    text-align: center;
    padding: 2rem;
    border-radius: var(--radius-lg);
    background: white;
}

.stat-card .stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

/* Tables */
.table {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 1.1rem 1.25rem;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(5, 150, 105, 0.04);
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

/* Pagination */
.pagination {
    gap: 0.5rem;
}

.pagination .page-link {
    border-radius: var(--radius-md);
    border: none;
    color: var(--text-body);
    background: white;
    padding: 0.8rem 1.1rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.pagination .page-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.35);
}

/* Utilities */
.text-muted {
    color: var(--text-muted) !important;
}

.bg-accent {
    background: var(--bg-gradient-start);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

/* Responsive */
@media (max-width: 991px) {
    .hero-section {
        padding: 80px 0 150px;
    }

    .section {
        padding: 70px 0;
    }

    .form-card {
        margin-top: -100px;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0 130px;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .section {
        padding: 50px 0;
    }

    .form-card {
        margin-top: -80px;
        margin-left: 0.75rem;
        margin-right: 0.75rem;
        border-radius: var(--radius-lg);
    }

    .card-body {
        padding: 1.5rem;
    }

    .btn-lg {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .program-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .program-item:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    .hero-section {
        background: var(--primary) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
