/* Microsoft-inspired design system */
:root {
    --primary-color: #0078D4;
    --secondary-color: #106EBE;
    --background-color: #F3F2F1;
    --text-color: #323130;
    --accent-color: #FFB900;
    --success-color: #107C10;
    --border-color: #E1DFDD;
    --hover-color: #F3F2F1;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Global styles */
body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Ripristino font di sistema predefinito */

/* Override Bootstrap primary color */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
}

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

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px var(--shadow-color);
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px var(--shadow-color);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* Contact cards */
.contact-card {
    transition: all 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

.contact-card .card-title {
    color: var(--text-color);
    font-weight: 600;
}

.contact-card .card-body {
    padding: 1.5rem;
}

.contact-card a {
    color: var(--primary-color);
    text-decoration: none;
}

.contact-card a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Forms */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-family: Verdana, sans-serif !important;
    font-size: 8pt !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 120, 212, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Sticky Controls */
.sticky-controls {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ghost Button Style */
.btn-ghost {
    background: transparent;
    border: none;
    padding: 0.25rem 0.75rem;
    transition: background-color 0.2s;
}

.btn-ghost:hover {
    background-color: var(--hover-color);
    border-radius: 4px;
}

/* Group Badge Styles */
.badge.rounded-pill {
    padding: 0.35em 0.8em;
    font-weight: 500;
    font-size: 0.875rem;
}

.group-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Contact Card Updates */
.contact-card .card-body {
    padding: 1.25rem;
}

.contact-card .contact-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.contact-card .contact-row {
    font-size: 0.9rem;
}

.contact-card .card-footer-actions {
    background: transparent;
}

/* Table Styles for List View */
.table-responsive {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

#contactsTable thead {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

#contactsTable thead th {
    background: var(--background-color);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

#contactsTable tbody tr {
    transition: background-color 0.2s;
}

#contactsTable tbody tr:hover {
    background-color: var(--hover-color);
}

#contactsTable tbody tr:hover .action-buttons {
    opacity: 1;
}

.action-buttons {
    opacity: 0;
    transition: opacity 0.2s;
}

/* Text truncation */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Search form */
.search-form .form-control {
    border-radius: 4px 0 0 4px;
}

.search-form .btn {
    border-radius: 0 4px 4px 0;
}

/* Buttons */
.btn {
    font-weight: 600;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-family: Verdana, sans-serif !important;
    font-size: 8pt !important;
    transition: all 0.3s ease;
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-outline-secondary:hover {
    background-color: var(--hover-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
}

.alert-success {
    background-color: rgba(16, 124, 16, 0.1);
    color: var(--success-color);
}

.alert-danger {
    background-color: rgba(196, 43, 28, 0.1);
    color: #C42B1C;
}

.alert-info {
    background-color: rgba(0, 120, 212, 0.1);
    color: var(--primary-color);
}

/* Dropdowns */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 16px var(--shadow-color);
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--hover-color);
    color: var(--text-color);
}

.dropdown-item.text-danger {
    color: #C42B1C !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .contact-card {
        margin-bottom: 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .search-form .form-control {
        margin-bottom: 0.5rem;
    }
}

/* Spacing system */
.mb-16 {
    margin-bottom: 1rem;
}

.mt-16 {
    margin-top: 1rem;
}

.p-16 {
    padding: 1rem;
}

/* Text utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Icon alignment */
.fas, .fab {
    vertical-align: middle;
}

/* Table-like layout for contact information */
.contact-info-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.contact-info-row i {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    color: var(--primary-color);
}

/* Microsoft Fluent design shadows */
.shadow-fluent {
    box-shadow: 0 1.6px 3.6px 0 var(--shadow-color), 0 0.3px 0.9px 0 var(--shadow-color);
}

.shadow-fluent-hover {
    box-shadow: 0 6.4px 14.4px 0 var(--shadow-color), 0 1.2px 3.6px 0 var(--shadow-color);
}

/* Authentication page styling */
.auth-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow-color);
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.auth-card .fab {
    font-size: 1.2rem;
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 1rem;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states */
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Copy email button */
.btn-copy-email {
    background-color: #20C997;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    min-width: 35px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-copy-email:hover {
    background-color: #1BA97F;
    color: white;
    transform: scale(1.05);
}

.btn-copy-email:active {
    transform: scale(0.95);
}

.btn-copy-email.copied {
    background-color: #107C10;
}

.btn-copy-email.copied i::before {
    content: "\f00c"; /* Font Awesome check icon */
}

/* Toast notification for copy feedback */
.copy-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--success-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Contact count badge */
h1 .badge {
    font-size: 0.5em;
    vertical-align: middle;
    background-color: #6c757d;
    font-weight: normal;
    padding: 0.35em 0.65em;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--text-color);
    }
    
    .btn-primary {
        border: 2px solid var(--text-color);
    }
}
