/* mobile.css - CSS specifico per dispositivi mobili */

/* ===== RESET E BASE ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* ===== LAYOUT RESPONSIVE ===== */
.container {
    width: 100%;
    padding: 0 15px;
    margin: 0 auto;
}

/* Mobile first approach */
@media (min-width: 576px) {
    .container { max-width: 540px; }
}

@media (min-width: 768px) {
    .container { max-width: 720px; }
}

@media (min-width: 992px) {
    .container { max-width: 960px; }
}

@media (min-width: 1200px) {
    .container { max-width: 1140px; }
}

/* ===== NAVIGATION MOBILE ===== */
.navbar-mobile {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
    color: white !important;
}

/* Hamburger menu styling */
.navbar-toggler {
    border: none;
    padding: 4px 8px;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

/* ===== CARDS ET CONTENUTO ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* ===== FORMS RESPONSIVE ===== */
.form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Mobile form optimizations */
@media (max-width: 576px) {
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    label {
        font-weight: 600;
        margin-bottom: 0.5rem;
        display: block;
    }
}

/* ===== BUTTONS MOBILE-FRIENDLY ===== */
.btn {
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Mobile button stack */
@media (max-width: 576px) {
    .btn {
        width: 100%;
        margin-bottom: 0.75rem;
        padding: 1rem 2rem;
    }
    
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group-mobile .btn {
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
}

@media (min-width: 577px) {
    .btn-group-mobile {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .btn-group-mobile .btn {
        flex: 1;
        margin-bottom: 0;
    }
}

/* ===== TABLES RESPONSIVE ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

@media (max-width: 768px) {
    .table-mobile-stack {
        border: 0;
    }
    
    .table-mobile-stack thead {
        display: none;
    }
    
    .table-mobile-stack tr {
        border: 1px solid #ccc;
        display: block;
        margin-bottom: 10px;
        border-radius: 8px;
        padding: 10px;
        background: white;
    }
    
    .table-mobile-stack td {
        border: none;
        display: block;
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    
    .table-mobile-stack td:before {
        content: attr(data-label);
        position: absolute;
        left: 6px;
        width: 45%;
        text-align: left;
        font-weight: bold;
    }
}

/* ===== ALERTS RESPONSIVE ===== */
.alert {
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: none;
}

.alert-danger {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
}

.alert-success {
    background: linear-gradient(135deg, #51cf66, #40c057);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #74c0fc, #339af0);
    color: white;
}

/* ===== UTILITIES MOBILE ===== */
/* Hide on mobile */
@media (max-width: 767px) {
    .d-mobile-none {
        display: none !important;
    }
}

/* Show only on mobile */
.d-mobile-block {
    display: none !important;
}

@media (max-width: 767px) {
    .d-mobile-block {
        display: block !important;
    }
}

/* Text responsive */
@media (max-width: 576px) {
    .text-mobile-center {
        text-align: center !important;
    }
    
    .text-mobile-small {
        font-size: 0.875rem !important;
    }
}

/* ===== ANIMATIONS MOBILE-FRIENDLY ===== */
@media (prefers-reduced-motion: no-preference) {
    .fade-in {
        animation: fadeIn 0.5s ease-in;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
/* Increase touch targets */
@media (max-width: 768px) {
    a, button, .btn, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better spacing for touch */
    .nav-link {
        padding: 12px 16px;
    }
}

/* ===== ACCESSIBILITY ===== */
/* Focus visible for keyboard navigation */
.btn:focus-visible,
.form-control:focus-visible,
a:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Better contrast for links */
a {
    color: #495057;
    text-decoration: underline;
}

a:hover {
    color: #667eea;
    text-decoration: none;
}