/**
 * CSS Portale Fornitori - Mercury Surgelati
 * Tema: pulito, moderno, mobile-first
 */

:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border: #dee2e6;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
    
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
}

/* === LAYOUT === */

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

.portale-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.portale-header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.portale-header .subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

.portale-header .user-info {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portale-header .user-name {
    font-weight: 600;
}

/* === CARDS === */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light);
}

.card-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.card-body {
    padding: 10px 0;
}

/* === ORDINI LIST === */

.ordini-list {
    display: grid;
    gap: 15px;
}

.ordine-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.ordine-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.ordine-card.urgente {
    border-left: 4px solid var(--danger);
}

.ordine-card.con-slot {
    border-left: 4px solid var(--success);
    background: #f0fff0;
}

.ordine-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.ordine-numero {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.ordine-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-urgente {
    background: var(--danger);
    color: white;
}

.badge-slot-ok {
    background: var(--success);
    color: white;
}

.badge-aperto {
    background: var(--warning);
    color: var(--dark);
}

.ordine-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-icon {
    font-size: 1.2rem;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
}

.ordine-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* === BUTTONS === */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* === WIZARD === */

.wizard {
    position: relative;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0 10px;
}

.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.wizard-step::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: var(--border);
    z-index: -1;
}

.wizard-step:first-child::before {
    display: none;
}

.wizard-step.active .step-circle {
    background: var(--primary);
    color: white;
}

.wizard-step.completed .step-circle {
    background: var(--success);
    color: white;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light);
    border: 3px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.wizard-step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

.wizard-content {
    min-height: 300px;
}

.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--light);
}

/* === FORMS === */

.form-group {
    margin-bottom: 20px;
}

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

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

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

.form-help {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* === ALERTS === */

.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning);
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: var(--info);
    color: #0c5460;
}

/* === MODAL === */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 2px solid var(--light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === LOADING === */

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === RESPONSIVE === */

@media (max-width: 768px) {
    .portale-container {
        padding: 10px;
    }
    
    .ordine-info {
        grid-template-columns: 1fr;
    }
    
    .ordine-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .wizard-steps {
        font-size: 0.8rem;
    }
    
    .step-circle {
        width: 30px;
        height: 30px;
    }
}

/* === LOGIN PAGE === */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 200px;
}

.login-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}
