/* ========================================
   Calcolatore Stipendio Italiano
   ======================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --bg-gradient: linear-gradient(135deg, #1e3a5f 0%, #3b82f6 100%);
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --success-bg: #d1fae5;
    --success-text: #065f46;
}

[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --success-bg: #064e3b;
    --success-text: #a7f3d0;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ========================================
   Header
   ======================================== */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    animation: fadeInDown 0.6s ease;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ========================================
   Theme Toggle
   ======================================== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(15deg);
}

/* ========================================
   Main Grid
   ======================================== */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Calculator Card
   ======================================== */
.calculator-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeInUp 0.6s ease;
}

.card-header {
    margin-bottom: 25px;
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group input[type="range"] {
    padding: 0;
    height: 8px;
    -webkit-appearance: none;
    background: var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.range-value {
    text-align: center;
    font-weight: bold;
    color: var(--primary);
    margin-top: 8px;
    font-size: 1.1rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

/* ========================================
   Buttons
   ======================================== */
.btn-calculate {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
}

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

/* ========================================
   Results Card
   ======================================== */
.results-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeInUp 0.6s ease 0.2s both;
}

.results-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border);
}

.results-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ========================================
   Net Salary Display
   ======================================== */
.net-salary-display {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    color: white;
    margin-bottom: 25px;
}

.net-salary-display .label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.net-salary-display .amount {
    font-size: 3rem;
    font-weight: 800;
}

.net-salary-display .period {
    font-size: 1rem;
    opacity: 0.8;
    margin-top: 5px;
}

/* ========================================
   Breakdown Section
   ======================================== */
.breakdown-section {
    margin-bottom: 25px;
}

.breakdown-section h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.breakdown-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
}

.breakdown-item .label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.breakdown-item .label .icon {
    font-size: 1.2rem;
}

.breakdown-item .value {
    font-weight: 700;
    font-size: 1.1rem;
}

.breakdown-item.deduction .value {
    color: var(--danger);
}

.breakdown-item.addition .value {
    color: var(--secondary);
}

/* ========================================
   Summary Cards
   ======================================== */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.summary-card .icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.summary-card .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.summary-card .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-card.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.summary-card.highlight .label,
.summary-card.highlight .value {
    color: white;
}

/* ========================================
   Info Box
   ======================================== */
.info-box {
    background: var(--success-bg);
    border: 1px solid var(--secondary);
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}

.info-box .info-title {
    font-weight: 600;
    color: var(--success-text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box .info-content {
    font-size: 0.9rem;
    color: var(--success-text);
    line-height: 1.6;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 0.5s ease;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }

    .calculator-card,
    .results-card {
        padding: 20px;
    }

    .net-salary-display .amount {
        font-size: 2.2rem;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .theme-toggle,
    .btn-calculate {
        display: none;
    }

    .calculator-card,
    .results-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
