/**
 * Common Styles - AllergiaAlNickel.it
 * Stili condivisi tra tutte le pagine del sito
 */

/* ===================================
   CSS VARIABLES
   =================================== */
:root {
    --primary: #3A86FF;
    --primary-dark: #2563eb;
    --primary-light: #6BA3FF;
    --secondary: #FFBE0B;
    --secondary-dark: #F39C12;
    --text-dark: #000222;
    --text-light: #6c757d;
    --bg-light: #F8F9FA;
    --bg-dark: #1a1a2e;
    --danger: #E63946;
    --success: #2ECC71;
    --warning: #F39C12;
    --info: #00D2FF;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0, 2, 34, 0.1);
    --shadow-hover: 0 20px 40px rgba(58, 134, 255, 0.2);
    --shadow-glow: 0 0 30px rgba(58, 134, 255, 0.4);
    --border-radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-light: #2a2a3e;
        --text-light: #a0a0b0;
    }
}

/* ===================================
   RESET & BASE STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===================================
   ANIMATED BACKGROUND
   =================================== */
.bg-animation {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    background: linear-gradient(-45deg, #3A86FF, #764ba2, #667eea, #FFBE0B);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    opacity: 0.8;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===================================
   CONTAINER
   =================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* ===================================
   HEADER BAR
   =================================== */
.header-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    animation: fadeInDown 0.6s ease;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: var(--transition);
}

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

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
}

.logo-text {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.nav-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(58, 134, 255, 0.3);
}

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

.nav-btn.secondary:hover {
    background: var(--primary);
    color: white;
}

/* ===================================
   BUTTONS
   =================================== */
.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(58, 134, 255, 0.3);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(58, 134, 255, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #27ae60);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #c0392b);
}

/* ===================================
   CARDS
   =================================== */
.card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease both;
}

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

.card-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--primary), #667eea);
    color: white;
    position: relative;
    overflow: hidden;
}

.card-body {
    padding: 2rem;
}

.card-footer {
    padding: 1.5rem 2rem;
    background: var(--bg-light);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* ===================================
   FORMS
   =================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--bg-light);
    border-radius: 10px;
    background: white;
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(58, 134, 255, 0.1);
}

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

/* ===================================
   BADGES
   =================================== */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
    border: 2px solid var(--success);
}

.badge-danger {
    background: rgba(230, 57, 70, 0.15);
    color: var(--danger);
    border: 2px solid var(--danger);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
    border: 2px solid var(--warning);
}

.badge-info {
    background: rgba(0, 210, 255, 0.15);
    color: var(--info);
    border: 2px solid var(--info);
}

/* ===================================
   ALERTS
   =================================== */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background: rgba(46, 204, 113, 0.1);
    border: 2px solid var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(230, 57, 70, 0.1);
    border: 2px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(0, 210, 255, 0.1);
    border: 2px solid var(--info);
    color: var(--info);
}

/* ===================================
   LOADING SPINNER
   =================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================
   BACK TO TOP BUTTON
   =================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 99;
    box-shadow: 0 5px 15px rgba(58, 134, 255, 0.3);
    border: none;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-5px);
}

/* ===================================
   COOKIE BANNER
   =================================== */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 2, 34, 0.95);
    color: white;
    padding: 1rem;
    display: none;
    z-index: 1000;
    animation: slideUp 0.5s ease;
}

.cookie-banner.show {
    display: block;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
}

.cookie-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.cookie-accept {
    background: var(--primary);
    color: white;
}

.cookie-settings {
    background: transparent;
    color: white;
    border: 1px solid white;
}

/* ===================================
   FOOTER
   =================================== */
footer {
    background: rgba(0, 2, 34, 0.95);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

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

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--secondary);
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

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

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* ===================================
   ACCESSIBILITY
   =================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-buttons {
        width: 100%;
        justify-content: center;
    }

    .cookie-content {
        flex-direction: column;
        text-align: center;
        padding: 0 1rem;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    .nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 1rem;
        right: 1rem;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    .bg-animation,
    .header-bar nav,
    .cookie-banner,
    .back-to-top {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
