/* ===== BUTTON COMPONENTS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    min-height: 40px;
    min-width: 44px;
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    transform-style: preserve-3d;
}

/* Effetto shimmer migliorato */
.btn::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -100%;
    width: 100%;
    height: calc(100% + 4px);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: skewX(-20deg);
}

.btn:hover::before {
    left: 100%;
}

/* Stati del bottone */
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.btn:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.3);
}

.btn:disabled::before {
    display: none;
}

.btn i {
    width: 16px;
    height: 16px;
    transition: all var(--transition-fast);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.btn:hover i {
    transform: scale(1.1) rotate(5deg);
}

.btn:active i {
    transform: scale(0.95);
}

/* Effetto ripple al click */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease-out, height 0.4s ease-out, opacity 0.4s ease-out;
    opacity: 0;
}

.btn:active::after {
    width: 300px;
    height: 300px;
    opacity: 0.3;
    transition: width 0s, height 0s, opacity 0s;
}

/* Button Sizes */
.btn.large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-base);
    min-height: 48px;
    border-radius: var(--radius-lg);
}

.btn.large i {
    width: 18px;
    height: 18px;
}

.btn.small {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
    min-height: 32px;
    border-radius: var(--radius-sm);
}

.btn.small i {
    width: 14px;
    height: 14px;
}

/* Button Variants */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), #4f46e5);
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #4338ca);
    border-color: var(--primary-dark);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3), 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

/* Effetto pulsante per bottoni d'azione */
@keyframes pulse {
    0% { box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1); }
    100% { box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1); }
}

.btn-primary.pulse {
    animation: pulse 2s infinite;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary:active {
    transform: translateY(0) scale(1.01);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.1s ease;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
    border-color: var(--accent-red);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: white;
    border-color: var(--accent-green);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
    color: white;
    border-color: var(--accent-orange);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    border-color: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* ===== FORM COMPONENTS ===== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.input-group label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    min-height: 44px;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group input:disabled,
.input-group select:disabled,
.input-group textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

/* Number Inputs */
input[type="number"] {
    text-align: center;
    font-weight: 600;
    font-size: var(--font-size-lg);
}

/* Range Inputs */
input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    outline: none;
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--primary-blue);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--primary-blue);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
}

/* Checkbox Inputs */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    min-height: auto;
}

/* ===== CARD COMPONENTS ===== */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    color: var(--text-secondary);
}

.card-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* ===== MODAL COMPONENTS ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--spacing-lg);
}

.modal.active {
    display: flex;
    animation: modalFadeIn var(--transition-normal);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn var(--transition-normal);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-close i {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* ===== PROGRESS BAR ===== */
.progress-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    height: 8px;
    overflow: hidden;
    margin: var(--spacing-md) 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-light));
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
    width: 0%;
}

/* ===== NOTIFICATION/TOAST ===== */
.notification-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.notification {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    min-width: 300px;
    animation: notificationSlideIn var(--transition-normal);
    position: relative;
    overflow: hidden;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-blue);
}

.notification.success::before {
    background: var(--accent-green);
}

.notification.error::before {
    background: var(--accent-red);
}

.notification.warning::before {
    background: var(--accent-orange);
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.notification-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
}

.notification-message {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== SETTING ITEMS ===== */
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.setting-item input,
.setting-item select {
    margin: 0;
    min-width: 120px;
}

/* ===== RESPONSIVE COMPONENTS ===== */
@media (max-width: 768px) {
    .modal-content {
        margin: var(--spacing-md);
        max-width: none;
    }
    
    .notification-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
    }
    
    .notification {
        min-width: auto;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .setting-item input,
    .setting-item select {
        width: 100%;
        min-width: auto;
    }
}

/* ===== TIMER SPECIFIC BUTTON STYLES ===== */

/* Bottone Start/Play con effetti speciali */
.btn-start, .btn-play {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    position: relative;
    overflow: hidden;
}

.btn-start:hover, .btn-play:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4), 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Bottone Pause con animazione di pausa */
.btn-pause {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
    position: relative;
}

.btn-pause:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-2px) scale(1.05);
}

.btn-pause::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}

/* Bottone Stop con effetto distintivo */
.btn-stop {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    position: relative;
}

.btn-stop:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4), 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Bottone Reset con animazione speciale */
.btn-reset {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
}

.btn-reset:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary-blue);
    border-style: solid;
    transform: translateY(-1px) rotate(-2deg);
}

/* Bottone Fullscreen con effetto di espansione */
.btn-fullscreen {
    position: relative;
    overflow: hidden;
}

.btn-fullscreen:hover {
    transform: translateY(-2px) scale(1.05);
}

.btn-fullscreen:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2), transparent 70%);
    pointer-events: none;
}

/* Stati attivi per i bottoni */
.btn.active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(1px);
}

.btn.running {
    animation: running-pulse 2s ease-in-out infinite;
}

@keyframes running-pulse {
    0%, 100% { 
        box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1); 
    }
    50% { 
        box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5), 0 3px 6px rgba(0, 0, 0, 0.15); 
    }
}

/* Preset buttons con hover migliorato */
.preset-btn {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.preset-btn:hover {
    background: linear-gradient(135deg, var(--primary-blue), #4f46e5);
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3), 0 4px 10px rgba(0, 0, 0, 0.15);
}

.preset-btn:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

/* Micro-animazioni per feedback tattile */
@keyframes button-click {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.btn:active {
    animation: button-click 0.15s ease-out;
}