/* 自定义样式 */

/* 空状态样式 */
.empty-state {
    @apply text-center py-12;
}

.empty-state-icon {
    @apply w-16 h-16 mx-auto mb-4 text-gray-300;
}

.empty-state-title {
    @apply text-lg font-medium text-gray-900 mb-2;
}

.empty-state-description {
    @apply text-sm text-gray-500 mb-6;
}

.empty-state-action {
    @apply inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors;
}

/* 全局loading遮罩 */
.loading-overlay {
    @apply fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50;
}

.loading-spinner {
    @apply w-12 h-12 border-4 border-blue-200 border-t-blue-600 rounded-full animate-spin;
}

/* 骨架屏动画 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 按钮loading状态 */
.btn-loading {
    @apply opacity-75 pointer-events-none relative;
}

.btn-loading::after {
    content: '';
    @apply absolute inset-0 flex items-center justify-center;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='currentColor' stroke-width='4' fill='none' opacity='0.25'/%3E%3Cpath fill='currentColor' d='M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z' opacity='0.75'/%3E%3C/svg%3E") center/20px no-repeat;
    animation: spin 1s linear infinite;
}

.tab-button.active {
    color: #2563eb;
    border-color: #2563eb;
}

.tab-button:not(.active):hover {
    color: #374151;
    border-color: #d1d5db;
}

/* 状态指示器 - 更可视化 */
.status-active {
    @apply bg-green-100 text-green-800 px-3 py-2 rounded-full text-sm font-semibold inline-flex items-center;
    border: 2px solid #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.status-active::before {
    content: '';
    @apply w-2 h-2 bg-green-500 rounded-full mr-2;
    animation: pulse-dot 2s infinite;
}

.status-inactive {
    @apply bg-red-100 text-red-800 px-3 py-2 rounded-full text-sm font-semibold inline-flex items-center;
    border: 2px solid #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.status-inactive::before {
    content: '';
    @apply w-2 h-2 bg-red-500 rounded-full mr-2;
}

.status-checking {
    @apply bg-yellow-100 text-yellow-800 px-3 py-2 rounded-full text-sm font-semibold inline-flex items-center;
    border: 2px solid #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.status-checking::before {
    content: '';
    @apply w-2 h-2 bg-yellow-500 rounded-full mr-2;
    animation: pulse-dot 1s infinite;
}

/* 状态指示器动画 */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.spin {
    animation: spin 1s linear infinite;
}

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

/* 响应式调整 */
@media (max-width: 640px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem 0.25rem;
    }
    
    .modal-content {
        @apply mx-4;
    }
    
    .notification {
        @apply left-4 right-4 top-4 max-w-none;
    }
    
    .stats-grid {
        @apply grid-cols-1 gap-4;
    }
    
    .action-buttons {
        @apply opacity-100;
    }
}

/* 模态框样式 */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    z-index: 9999 !important;
    animation: modalFadeIn 0.2s ease-out;
}

.modal-content {
    background-color: white !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    max-width: 28rem !important;
    width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    transform: translateY(0) !important;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: scale(0.95) translateY(-20px); 
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0); 
    }
}

/* 确认对话框样式 */
.confirm-dialog .modal-content {
    max-width: 24rem !important;
    text-align: center !important;
}

.confirm-icon {
    width: 4rem !important;
    height: 4rem !important;
    margin: 0 auto 1rem auto !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.confirm-icon.warning {
    background-color: #fef3c7 !important;
    color: #d97706 !important;
}

.confirm-icon.danger {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
}

.confirm-icon.info {
    background-color: #dbeafe !important;
    color: #2563eb !important;
}

.confirm-icon.success {
    background-color: #d1fae5 !important;
    color: #059669 !important;
}

/* API Key显示样式 */
.api-key-display {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid #d1d5db;
}

/* 描述列样式优化 */
.description-cell {
    position: relative;
    cursor: help;
    transition: all 0.2s ease;
}

.description-cell:hover {
    max-height: none !important;
    overflow: visible !important;
    z-index: 10;
    background: white;
    padding: 0.5rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

/* 通知样式 */
.notification {
    @apply fixed top-4 right-4 p-4 rounded-lg shadow-lg z-50 max-w-sm transform transition-all duration-300;
    animation: slideInRight 0.3s ease-out;
}

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

.notification.hide {
    animation: slideOutRight 0.3s ease-in forwards;
}

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

.notification-success {
    @apply bg-green-500 text-white;
}

.notification-error {
    @apply bg-red-500 text-white;
}

.notification-warning {
    @apply bg-yellow-500 text-white;
}

.notification-info {
    @apply bg-blue-500 text-white;
}

/* 加载状态 */
.loading {
    @apply opacity-50 pointer-events-none;
}

/* 表格行悬停效果 */
.table-row {
    @apply transition-colors duration-150;
}

.table-row:hover {
    @apply bg-gray-50;
}

.table-row.updating {
    @apply bg-blue-50 animate-pulse;
}

/* 操作按钮组 */
.action-buttons {
    @apply flex space-x-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200;
}

.table-row:hover .action-buttons {
    @apply opacity-100;
}

/* 状态指示器动画 */
.status-checking {
    @apply bg-yellow-100 text-yellow-800 px-2 py-1 rounded-full text-xs font-medium relative;
}

.status-checking::after {
    content: '';
    @apply absolute -inset-1 border-2 border-yellow-300 rounded-full;
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* 成功效果 */
.success-effect {
    position: relative;
    overflow: hidden;
}

.success-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shine 0.8s ease-in-out;
}

@keyframes shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}


/* 表格加载状态 */
.table-loading {
    @apply opacity-50 pointer-events-none;
}

.table-loading tbody {
    position: relative;
}

.table-loading tbody::after {
    content: '加载中...';
    @apply absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 text-gray-500;
}

/* 自定义滚动条 */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}