/*
  Professional Enhancements CSS
  Additional professional features for ISP CRM
  Version: 2.1
*/

/* ====================================
   TOAST NOTIFICATION SYSTEM
==================================== */

.toast-container {
    position: fixed;
    top: 90px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
}

.toast {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.15);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border-left: 4px solid;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 320px;
    max-width: 420px;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ffffff;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: linear-gradient(135deg, #10b981 0%, #22c55e 100%);
}

.toast.error .toast-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.warning .toast-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.toast.info .toast-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px 0;
}

.toast-message {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #64748b;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.removing {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ====================================
   LOADING STATES & SKELETON SCREENS
==================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

/* Skeleton Screens */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    padding: 24px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-text {
    height: 16px;
    width: 100%;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ====================================
   ENHANCED DATA TABLES
==================================== */

.table-enhanced {
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.table-enhanced-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.table-enhanced-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-enhanced-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-search {
    position: relative;
}

.table-search-input {
    width: 260px;
    height: 40px;
    padding: 0 40px 0 40px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.25s ease;
}

.table-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.table-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
}

.table-filter-btn, .table-export-btn {
    height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    background: #ffffff;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.table-filter-btn:hover, .table-export-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.table-wrapper {
    overflow-x: auto;
}

.table-enhanced table {
    width: 100%;
    border-collapse: collapse;
}

.table-enhanced thead th {
    padding: 16px 24px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(99, 102, 241, 0.04);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.table-enhanced thead th:hover {
    background: rgba(99, 102, 241, 0.08);
}

.table-enhanced thead th .sort-icon {
    margin-left: 8px;
    font-size: 12px;
    color: #94a3b8;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.table-enhanced thead th:hover .sort-icon,
.table-enhanced thead th.sorted .sort-icon {
    opacity: 1;
}

.table-enhanced tbody tr {
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    transition: background 0.2s ease;
}

.table-enhanced tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.table-enhanced tbody td {
    padding: 16px 24px;
    font-size: 14px;
    color: #0f172a;
}

.table-pagination {
    padding: 16px 24px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-pagination-info {
    font-size: 14px;
    color: #64748b;
}

.table-pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-pagination-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    background: #ffffff;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.table-pagination-btn:hover:not(:disabled) {
    border-color: #6366f1;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.table-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.table-pagination-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

/* ====================================
   ERROR PAGES (404, 500)
==================================== */

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f6f7fb 0%, #e9ecf5 100%);
    padding: 40px 20px;
}

.error-container {
    max-width: 600px;
    text-align: center;
}

.error-code {
    font-size: 120px;
    font-weight: 900;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 24px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.error-title {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 16px 0;
}

.error-message {
    font-size: 16px;
    color: #64748b;
    margin: 0 0 32px 0;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.error-btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.25s ease;
}

.error-btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: #ffffff;
    border: none;
}

.error-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.error-btn-secondary {
    background: #ffffff;
    color: #6366f1;
    border: 2px solid #6366f1;
}

.error-btn-secondary:hover {
    background: #6366f1;
    color: #ffffff;
}

/* ====================================
   SEARCH AUTOCOMPLETE
==================================== */

.search-autocomplete {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(2, 6, 23, 0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-autocomplete.active {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-autocomplete-group {
    padding: 12px 0;
}

.search-autocomplete-group:not(:last-child) {
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.search-autocomplete-header {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-autocomplete-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-autocomplete-item:hover {
    background: rgba(99, 102, 241, 0.06);
}

.search-autocomplete-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.search-autocomplete-content {
    flex: 1;
    min-width: 0;
}

.search-autocomplete-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 2px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-autocomplete-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

/* ====================================
   CONFIRM DIALOG
==================================== */

.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.confirm-dialog {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(2, 6, 23, 0.2);
    max-width: 480px;
    width: calc(100% - 40px);
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-header {
    padding: 24px 24px 16px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #ffffff;
    flex-shrink: 0;
}

.confirm-icon.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.confirm-icon.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.confirm-icon.info {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.confirm-content {
    flex: 1;
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.confirm-message {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

.confirm-actions {
    padding: 16px 24px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.confirm-btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.confirm-btn-cancel:hover {
    background: #e2e8f0;
}

.confirm-btn-confirm {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: #ffffff;
}

.confirm-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.confirm-btn-confirm.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ====================================
   PROGRESS BAR
==================================== */

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #7c3aed 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmerProgress 1.5s infinite;
}

@keyframes shimmerProgress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ====================================
   EMPTY STATES
==================================== */

.empty-state {
    padding: 60px 40px;
    text-align: center;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #6366f1;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px 0;
}

.empty-state-message {
    font-size: 15px;
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.6;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-action {
    display: inline-flex;
}

/* ====================================
   BADGE ENHANCEMENTS
==================================== */

.badge-enhanced {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.badge-enhanced.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
}

.badge-enhanced.status-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
}

.badge-enhanced.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.badge-enhanced .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ====================================
   KEYBOARD SHORTCUTS GUIDE
==================================== */

.shortcuts-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.shortcuts-content {
    background: #ffffff;
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.3);
}

.shortcuts-header {
    padding: 32px 32px 24px 32px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.shortcuts-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.shortcuts-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.shortcuts-body {
    padding: 32px;
}

.shortcuts-section {
    margin-bottom: 32px;
}

.shortcuts-section:last-child {
    margin-bottom: 0;
}

.shortcuts-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 16px 0;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-description {
    font-size: 14px;
    color: #0f172a;
    font-weight: 500;
}

.shortcut-keys {
    display: flex;
    gap: 6px;
}

.shortcut-key {
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    font-family: 'Fira Code', monospace;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shortcuts-footer {
    padding: 24px 32px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    text-align: center;
}

.shortcuts-footer-text {
    font-size: 13px;
    color: #94a3b8;
}

/* ====================================
   RESPONSIVE
==================================== */

@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
        top: 80px;
    }
    
    .toast {
        min-width: 0;
    }
    
    .table-search-input {
        width: 100%;
    }
    
    .error-code {
        font-size: 80px;
    }
    
    .error-title {
        font-size: 24px;
    }
    
    .shortcuts-content {
        max-height: 90vh;
    }
    
    .shortcuts-header,
    .shortcuts-body,
    .shortcuts-footer {
        padding: 24px 20px;
    }
}

