/* Presenza — components.css */

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--dur-fast) var(--ease);
    user-select: none;
    min-height: 40px;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; color: #fff; }

.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-hover); color: var(--text); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); box-shadow: none; }

.btn-sm { padding: 7px 12px; font-size: 12px; min-height: 34px; }
.btn-lg { padding: 14px 26px; font-size: var(--fs-md); min-height: 48px; }
.btn-icon { padding: 0; width: 40px; height: 40px; min-height: auto; }
.btn-icon.btn-sm { width: 34px; height: 34px; }

/* CARDS */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--s-5);
    box-shadow: var(--shadow-xs);
}
.card + .card { margin-top: var(--s-5); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    flex-wrap: wrap;
    margin-bottom: var(--s-4);
}
.card-title {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: var(--s-2);
}
@media (min-width: 768px) { .card { padding: var(--s-6); } }

/* FORMS */
.form-group { margin-bottom: var(--s-4); }
.form-group label, .form-label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--s-2);
}
.form-group label .required, .form-label .required { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--s-1); line-height: 1.5; }

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="url"],
.form-group input[type="tel"],
.form-group input[type="search"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: var(--fs-base);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
    min-height: 42px;
    font-family: inherit;
}
.form-group input[type="file"] { padding: 8px; background: var(--surface-2); cursor: pointer; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.form-group textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

.checkbox, .radio {
    display: flex;
    align-items: flex-start;
    gap: var(--s-2);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text);
    user-select: none;
    padding: 4px 0;
}
.checkbox input[type="checkbox"], .radio input[type="radio"] {
    width: 18px;
    height: 18px;
    min-height: auto;
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
    flex: 0 0 auto;
}

.form-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
@media (min-width: 640px) {
    .form-grid-2 { grid-template-columns: 1fr 1fr; }
    .form-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* TABLES */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table th, table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table th {
    background: var(--surface-2);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
table tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--surface-hover); }
table td.numeric, table th.numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success-text); border-color: transparent; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger-text);  border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); border-color: transparent; }
.badge-info    { background: var(--info-soft);    color: var(--info-text);    border-color: transparent; }
.badge-neutral { background: var(--surface-2);    color: var(--text-secondary); }

/* ALERTS */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: var(--s-4);
    font-size: var(--fs-sm);
    line-height: 1.55;
    border: 1px solid transparent;
    white-space: pre-wrap;
    word-break: break-word;
}
.alert-info    { background: var(--info-soft);    color: var(--info-text);    border-color: rgba(59, 130, 246, 0.3); }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: rgba(16, 185, 129, 0.3); }
.alert-danger  { background: var(--danger-soft);  color: var(--danger-text);  border-color: rgba(239, 68, 68, 0.3); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); border-color: rgba(245, 158, 11, 0.3); }

/* MODALS */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: var(--s-4);
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--s-6);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

/* AVATARS */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    font-size: var(--fs-md);
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid var(--surface);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-xl); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--fs-2xl); }

/* DROPDOWN */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--s-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--dur-fast) var(--ease);
    z-index: 100;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    color: var(--text);
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease);
}
.dropdown-menu a:hover { background: var(--surface-2); color: var(--text); }
.dropdown-divider { height: 1px; background: var(--border); margin: var(--s-1) 0; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: var(--s-10) var(--s-4); color: var(--text-muted); }
.empty-state .icon { font-size: 42px; margin-bottom: var(--s-3); opacity: 0.5; }
.empty-state h3 { font-size: var(--fs-lg); color: var(--text); margin-bottom: var(--s-2); }
