/* ============================================================================
   UX ENHANCEMENTS - Estilos para Melhorias de Interface
   ============================================================================ */

/* 1. FEEDBACK VISUAL - Estados de Botão */
.btn:active {
    transform: scale(0.95);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading .fas {
    color: transparent;
}

.btn-loading .btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.copied {
    background: var(--success-color) !important;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 10000;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast i {
    font-size: 1.5rem;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-success i {
    color: var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-error i {
    color: var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-warning i {
    color: var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

.toast-info i {
    color: var(--primary-color);
}

/* 3. RESPONSIVIDADE TOUCH */
@media (max-width: 768px) {
    .btn,
    .btn-action,
    .btn-theme {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }

    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filters-container {
        flex-direction: column;
        gap: 10px;
    }

    .filter-select,
    .search-box {
        width: 100%;
    }

    .stats-container {
        grid-template-columns: 1fr 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr;
    }

    .header-content h1 {
        font-size: 1.8rem;
    }

    .btn {
        font-size: 0.9rem;
    }
}

/* 4. CONFIRM MODAL */
.confirm-modal {
    max-width: 500px;
    text-align: center;
    padding: 40px;
}

.confirm-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.confirm-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.confirm-icon.info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.confirm-modal h2 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.confirm-modal p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-actions .btn-primary.danger {
    background: var(--danger-color);
}

.confirm-actions .btn-primary.danger:hover {
    background: #dc2626;
}

/* 5. ACCESSIBILITY - Focus Visible */
*:focus {
    outline: none;
}

*:focus-visible,
.keyboard-focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* 6. EMPTY STATES */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    grid-column: 1 / -1;
}

.empty-state.visible {
    opacity: 1;
    transform: translateY(0);
}

.empty-state-content {
    max-width: 500px;
    margin: 0 auto;
}

.empty-state i {
    font-size: 5rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
}

.empty-state .btn-primary {
    margin-top: 10px;
}

/* 9. ONBOARDING TOUR */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

.onboarding-highlight {
    position: relative;
    z-index: 9999 !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 20px rgba(37, 99, 235, 0.5) !important;
    border-radius: 8px;
}

.onboarding-tooltip {
    position: fixed;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    z-index: 10000;
    box-shadow: var(--shadow-hover);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.onboarding-content h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.onboarding-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.onboarding-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.onboarding-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-skip {
    background: transparent;
    color: var(--text-secondary);
}

.btn-skip:hover {
    color: var(--text-primary);
}

.btn-prev,
.btn-next {
    background: var(--primary-color);
    color: white;
}

.btn-prev:hover,
.btn-next:hover {
    background: var(--secondary-color);
}

.step-counter {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-right: 10px;
}

/* 10. NOTIFICATION CENTER */
.notification-center {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.notification-center.active {
    right: 0;
}

.notification-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-clear-all {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-clear-all:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.notification-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: var(--transition);
    cursor: pointer;
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.1);
    border-left: 3px solid var(--primary-color);
}

.notification-item.read {
    background: rgba(255, 255, 255, 0.05);
    opacity: 0.7;
}

.notification-item:hover {
    background: var(--card-bg-hover);
    transform: translateX(-5px);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.notification-icon.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.notification-icon.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.notification-icon.info {
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-color);
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.notification-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
    line-height: 1.4;
}

.notification-content small {
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.7;
}

.empty-notifications {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-notifications i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* 11. ANIMAÇÕES MELHORADAS */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.service-card {
    animation: slideInUp 0.3s ease;
}

.modal.active .modal-content {
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-card {
    animation: fadeIn 0.5s ease;
}

/* Hover com micro-interações */
.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

/* 12. HIERARQUIA VISUAL MELHORADA */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
}

h4 {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Status badges com mais contraste */
.status-badge.online {
    background: var(--success-color);
    color: white;
    font-weight: 600;
}

.status-badge.offline {
    background: var(--danger-color);
    color: white;
    font-weight: 600;
}

/* Botões com hierarquia clara */
.btn-primary {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* 15. VALIDAÇÃO EM TEMPO REAL */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: var(--danger-color);
}

.form-group.success input,
.form-group.success select,
.form-group.success textarea {
    border-color: var(--success-color);
}

.form-group .validation-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.form-group.error .validation-icon {
    color: var(--danger-color);
}

.form-group.success .validation-icon {
    color: var(--success-color);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.form-group.error .error-message {
    display: block;
}

/* 16. ANIMATED COUNTERS */
.stat-card h3 {
    font-variant-numeric: tabular-nums;
}

.stat-value-change {
    display: inline-block;
    animation: countUp 0.5s ease;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 17. DRAG & DROP ZONES */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.drop-zone i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

/* 18. BREADCRUMBS */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.breadcrumb-item {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-item:hover {
    color: var(--text-primary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

/* 20. SMOOTH SCROLL */
html {
    scroll-behavior: smooth;
}

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
}

/* 21. DARK MODE TRANSITION */
body,
.header,
.service-card,
.stat-card,
.modal-content,
.notification-center {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 22. GRÁFICOS INTERATIVOS */
.chart-box canvas {
    cursor: crosshair;
}

.chart-tooltip-custom {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: var(--shadow);
}

/* 24. FAVORITES AUTO-SORT */
.service-card.favorite {
    border: 2px solid var(--warning-color);
    order: -1;
}

/* 26. USER PROFILES */
.profile-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.profile-option {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.profile-option.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 29. SHARE DASHBOARD */
.share-link-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-link-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
}

.btn-copy-link {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy-link:hover {
    background: var(--secondary-color);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Notification Center ocupa tela toda */
    .notification-center {
        width: 100%;
        right: -100%;
    }

    .notification-center.open {
        right: 0;
    }

    /* Tooltips de onboarding adaptados */
    .onboarding-tooltip {
        max-width: 90%;
        left: 5% !important;
        right: 5%;
        padding: 20px;
    }

    .onboarding-tooltip h3 {
        font-size: 1.25rem;
    }

    .onboarding-tooltip p {
        font-size: 1rem;
        line-height: 1.6;
    }

    .onboarding-actions {
        flex-direction: column;
        gap: 12px;
    }

    .onboarding-actions button {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
    }

    /* Toasts maiores e mais visíveis */
    .toast {
        max-width: calc(100% - 30px);
        left: 15px;
        right: 15px;
        padding: 18px 20px;
        font-size: 1rem;
        border-radius: 12px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    }

    .toast i {
        font-size: 1.5rem;
    }

    /* Modal de confirmação adaptado */
    .confirm-modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        padding: 25px;
    }

    .confirm-modal-content h3 {
        font-size: 1.35rem;
    }

    .confirm-modal-content p {
        font-size: 1rem;
        line-height: 1.6;
    }

    .confirm-modal-actions {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .confirm-modal-actions button {
        width: 100%;
        min-height: 52px;
        font-size: 1.1rem;
    }

    /* Empty states maiores */
    .empty-state {
        padding: 60px 20px;
    }

    .empty-state i {
        font-size: 4rem;
    }

    .empty-state h3 {
        font-size: 1.5rem;
    }

    .empty-state p {
        font-size: 1rem;
        line-height: 1.6;
    }

    .empty-state button {
        min-height: 52px;
        font-size: 1.1rem;
        padding: 16px 32px;
    }

    /* Scroll to top mobile */
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 1.75rem;
    }

    /* Drop zones mobile */
    .drop-zone {
        padding: 30px 20px;
    }

    .drop-zone i {
        font-size: 2.5rem;
    }

    .drop-zone p {
        font-size: 1rem;
    }

    /* Breadcrumbs mobile */
    .breadcrumbs {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }

    /* Profile selector mobile */
    .profile-selector {
        flex-direction: column;
    }

    .profile-option {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        min-height: 48px;
    }

    /* Share link mobile */
    .share-link-container {
        flex-direction: column;
    }

    .share-link-input {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
    }

    .btn-copy-link {
        width: 100%;
        min-height: 48px;
        font-size: 1rem;
    }
}

/* Extra Small Mobile (< 576px) */
@media (max-width: 576px) {
    .toast {
        max-width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        padding: 16px 18px;
        font-size: 0.95rem;
    }

    .onboarding-tooltip {
        padding: 18px;
    }

    .onboarding-tooltip h3 {
        font-size: 1.15rem;
    }

    .onboarding-tooltip p {
        font-size: 0.95rem;
    }

    .empty-state {
        padding: 40px 15px;
    }

    .empty-state i {
        font-size: 3.5rem;
    }

    .empty-state h3 {
        font-size: 1.35rem;
    }
}
