/* ========================================
   MODERNA UI - Romana Serrande
   Palette: Blu profondo + Arancio segnaletico
   ======================================== */

:root {
    /* Colori primari */
    --primary: #f97316;
    --primary-light: #fb923c;
    --primary-dark: #c2410c;
    --secondary: #3b82f6;
    --secondary-light: #60a5fa;
    --accent: #22c55e;
    
    /* Neutri */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border: #e5e7eb;
    
    /* Scuro (tema) */
    --dark-bg-primary: #0f172a;
    --dark-bg-secondary: #1e293b;
    --dark-bg-tertiary: #334155;
    --dark-text-primary: #f1f5f9;
    --dark-text-secondary: #cbd5e1;
    --dark-border: #334155;
    
    /* Feedback */
    --error: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --info: #0ea5e9;
    
    /* Shadow */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
}

/* ========================================
   ANIMAZIONI GLOBALI
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: var(--shadow-md);
    }
    50% {
        box-shadow: 0 0 20px rgba(249, 115, 22, 0.4);
    }
}

/* Dark mode */
[data-theme="dark"] {
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --border: #475569;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    animation: fadeIn 0.5s ease-in;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   HEADER
   ======================================== */

header {
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideInDown 0.5s ease-out;
}

header hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0;
}

.header-top {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.6s ease-out 0.1s both;
}

.site-brand h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-nav {
    display: flex;
    gap: 16px;
    align-items: center;
}

.main-nav a {
    color: #e0e7ff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateY(-1px);
}

.main-nav a:hover::after {
    width: 100%;
}

/* Contenitore pulsanti destra header */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.6s ease-out 0.2s both;
}

#cartCountButton {
    padding: 10px 16px !important;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: var(--radius-lg);
    white-space: nowrap;
}

#cartCountButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
    animation: bounce 0.4s ease;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(-20deg) scale(1.05);
}

.theme-toggle:hover::before {
    width: 100%;
    height: 100%;
}

.theme-icon { 
    display: none;
    animation: fadeIn 0.3s ease;
}

[data-theme="dark"] .theme-icon-sun { 
    display: inline; 
}

[data-theme="light"] .theme-icon-moon { 
    display: inline; 
}

/* ========================================
   MAIN & FOOTER
   ======================================== */

main {
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 20px;
    min-height: calc(100vh - 300px);
}

footer {
    max-width: 1200px;
    margin: 48px auto 0;
    padding: 24px 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   TITOLI
   ======================================== */

h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 20px 0 12px;
    color: var(--text-primary);
}

/* ========================================
   CARDS PRODOTTI
   ======================================== */

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.product {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 16px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.product:nth-child(1) { animation-delay: 0.05s; }
.product:nth-child(2) { animation-delay: 0.1s; }
.product:nth-child(3) { animation-delay: 0.15s; }
.product:nth-child(4) { animation-delay: 0.2s; }
.product:nth-child(n+5) { animation-delay: 0.25s; }

.product:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.product h3 {
    margin: 0 0 8px;
    font-size: 1.125rem;
}

.product p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    flex-grow: 1;
}

.product strong {
    display: block;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.product form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-top: auto;
}

.product input[type="number"] {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.product button {
    flex: 1;
}

.product a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-md);
    text-decoration: none;
    width: 100%;
    text-align: center;
}

.product a:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   FORM
   ======================================== */

.form-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    max-width: 600px;
    margin: 24px 0;
    animation: slideInUp 0.5s ease-out;
    transition: all 0.3s ease;
}

.form-container:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.form-group {
    margin-bottom: 20px;
    animation: slideInUp 0.5s ease-out;
}

.form-group:nth-child(1) { animation-delay: 0.05s; }
.form-group:nth-child(2) { animation-delay: 0.1s; }
.form-group:nth-child(3) { animation-delay: 0.15s; }

.form-group:last-child {
    margin-bottom: 0;
}

form {
    margin: 20px 0;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin: 16px 0;
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

fieldset:hover {
    border-color: var(--primary);
}

legend {
    padding: 0 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-dark);
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

label span.required {
    color: var(--error);
    animation: pulse 1.5s infinite;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="password"],
textarea,
select {
    width: 100%;
    max-width: 480px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1), inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input[type="checkbox"],
input[type="radio"] {
    margin-right: 0px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-item,
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-item label,
.checkbox-item label {
    margin: 0;
    cursor: pointer;
}

/* ========================================
   BOTTONI
   ======================================== */

button,
input[type="submit"],
input[type="button"],
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

button::before,
input[type="submit"]::before,
input[type="button"]::before,
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: -1;
}

button:hover::before,
input[type="submit"]:hover::before,
input[type="button"]:hover::before,
.btn:hover::before {
    width: 300px;
    height: 300px;
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.5);
}

button:active,
input[type="submit"]:active,
.btn:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(249, 115, 22, 0.1);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    box-shadow: none;
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-hero-dark {
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.btn-hero-dark:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ========================================
   MESSAGGI
   ======================================== */

.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    border-left: 4px solid var(--error);
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

.alert-success {
    background: linear-gradient(135deg, #dcfce7 0%, #bef264 100%);
    color: #166534;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    border-left: 4px solid var(--success);
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

/* ========================================
   TABELLE
   ======================================== */

.cart-table,
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 20px 0;
}

table thead {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

table th {
    padding: 12px 16px;
    font-weight: 600;
    text-align: left;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

table tbody tr {
    transition: all 0.2s;
}

table tbody tr:hover {
    background: var(--bg-secondary);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 16px;
        padding: 16px 20px;
    }
    
    .site-brand {
        width: 100%;
        justify-content: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
        gap: 12px;
    }
    
    .main-nav a {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    #cartCountButton {
        padding: 10px 14px !important;
        font-size: 0.85rem;
    }
    
    .theme-toggle {
        width: 40px !important;
        height: 40px !important;
    }
    
    main {
        margin: 20px auto;
        padding: 0 16px;
    }
    
    .products {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    textarea {
        max-width: 100%;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    table th,
    table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0;
    }
    
    .header-top {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .site-brand h1 {
        font-size: 1.1rem;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .main-nav {
        gap: 8px;
    }
    
    .main-nav a {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    #cartCountButton {
        padding: 8px 12px !important;
        font-size: 0.8rem;
    }
    
    .theme-toggle {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem;
    }
    
    .products {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .form-container {
        padding: 16px;
        max-width: 100%;
    }
}

/* ========================================
   BADGE STATI
   ======================================== */

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fbbf24;
}

.badge-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #10b981;
}

.badge-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 1px solid #3b82f6;
}

.badge-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Status badge per service requests */
.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.pending {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.status-badge.completed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

/* ========================================
   MIGLIORAMENTI IMMAGINI CATEGORIE
   ======================================== */

.service-category-img,
.service-category-img-large {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover .service-category-img {
    transform: scale(1.05);
}

.service-category-img-large:hover {
    transform: scale(1.02);
}

