/**
 * CSS Principale - Sistema Ticket
 * Design sobrio grigio/neutro con accenti verdi
 * Regali & Cadeaux
 */

/* ===== VARIABILI CSS ===== */
:root {
    /* Palette Grigio/Neutro */
    --color-primary: #2d3748;
    --color-secondary: #4a5568;
    --color-tertiary: #718096;

    /* Accenti */
    --color-success: #48bb78;
    --color-success-dark: #38a169;
    --color-info: #4299e1;
    --color-warning: #ed8936;
    --color-danger: #f56565;

    /* Backgrounds */
    --bg-body: #f7fafc;
    --bg-white: #ffffff;
    --bg-light: #edf2f7;
    --bg-lighter: #f7fafc;

    /* Testo */
    --text-dark: #1a202c;
    --text-normal: #2d3748;
    --text-light: #718096;
    --text-lighter: #a0aec0;

    /* Bordi */
    --border-color: #e2e8f0;
    --border-color-dark: #cbd5e0;

    /* Ombre */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Rounding */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transizioni */
    --transition: all 0.2s ease;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* ===== CONTAINER & LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-sm {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-lighter);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-lighter);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 0.5rem;
}

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

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

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

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

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

.btn-outline {
    background: transparent;
    color: var(--color-secondary);
    border-color: var(--border-color-dark);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-light);
    border-color: var(--color-secondary);
}

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

.btn-danger:hover:not(:disabled) {
    background: #e53e3e;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9375rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-normal);
    background-color: var(--bg-white);
    border: 1px solid var(--border-color-dark);
    border-radius: var(--radius);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-success);
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

.form-control::placeholder {
    color: var(--text-lighter);
}

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-text {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.form-error {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: var(--color-danger);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.alert i {
    margin-top: 2px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    gap: 0.375rem;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-gray {
    background-color: #f3f4f6;
    color: #374151;
}

/* ===== NAVIGATION ===== */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    color: var(--text-normal);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    color: var(--color-success);
}

.nav-link.active {
    color: var(--color-success);
}

/* ===== LANGUAGE SELECTOR ===== */
.language-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.lang-btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-light);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
}

.lang-btn:hover {
    color: var(--text-dark);
    border-color: var(--border-color-dark);
}

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

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.table th {
    background: var(--bg-lighter);
    color: var(--text-dark);
    font-weight: 600;
    text-align: left;
    padding: 0.875rem 1rem;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-normal);
}

.table tbody tr:hover {
    background: var(--bg-lighter);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    gap: 0.375rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border-color-dark);
    border-radius: var(--radius-sm);
    color: var(--text-normal);
    text-decoration: none;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--bg-light);
    border-color: var(--color-secondary);
}

.pagination .active {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9375rem;
    color: var(--text-light);
    font-weight: 500;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.stat-icon.success {
    background: #d1fae5;
    color: #065f46;
}

.stat-icon.info {
    background: #dbeafe;
    color: #1e40af;
}

.stat-icon.warning {
    background: #fef3c7;
    color: #92400e;
}

/* ===== ATTACHMENTS ===== */
.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.attachment-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    color: var(--text-light);
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9375rem;
}

.attachment-size {
    font-size: 0.8125rem;
    color: var(--text-light);
}

/* ===== MESSAGES/TIMELINE ===== */
.message-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.message-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--color-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.message-avatar.staff {
    background: var(--color-secondary);
}

.message-content {
    flex: 1;
    background: var(--bg-light);
    padding: 1rem;
    border-radius: var(--radius);
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.message-author {
    font-weight: 600;
    color: var(--text-dark);
}

.message-time {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.message-body {
    color: var(--text-normal);
    line-height: 1.6;
}

.message-internal {
    background: #fef3c7;
    border-left: 3px solid var(--color-warning);
}

/* ===== GRID SYSTEM ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

@media (max-width: 768px) {
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar-nav {
        gap: 1rem;
    }

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

    .table {
        font-size: 0.875rem;
    }

    .table th, .table td {
        padding: 0.625rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* ===== LOADING SPINNER ===== */
.spinner {
    border: 3px solid var(--bg-light);
    border-top: 3px solid var(--color-success);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    animation: spin 0.8s linear infinite;
}

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

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}
