/* ============================================
 * 视创云体教通 - 全局自定义样式
 * ============================================ */

/* === Alpine.js 防闪烁 === */
[x-cloak] { display: none !important; }

/* === 全局过渡动画 === */
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.2s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

/* === 模态框动画 === */
.modal-enter-active { transition: all 0.25s ease-out; }
.modal-leave-active { transition: all 0.2s ease-in; }
.modal-enter-from, .modal-leave-to {
    opacity: 0;
    transform: scale(0.95);
}

/* === 页面切换动画 === */
.page-enter-active { transition: all 0.2s ease-out; }
.page-leave-active { transition: all 0.15s ease-in; }
.page-enter-from { opacity: 0; transform: translateY(8px); }
.page-leave-to { opacity: 0; transform: translateY(-8px); }

/* === 表单控件增强 === */
input:focus, select:focus, textarea:focus {
    outline: none;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
textarea:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
input.error, select.error, textarea.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
input:disabled, select:disabled, textarea:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* === 按钮增强 === */
button:active:not(:disabled) {
    transform: scale(0.97);
    transition: transform 0.1s;
}
button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.btn-loading {
    position: relative;
    pointer-events: none;
}
.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* === 表格增强 === */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table th {
    font-weight: 600;
    white-space: nowrap;
}
table td {
    vertical-align: middle;
}
tr.row-clickable {
    cursor: pointer;
}
tr.row-clickable:hover {
    background-color: #f9fafb;
}

/* === 通知/Toast === */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}
.toast {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toast-slide-in 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast-success { background: #065f46; color: #fff; }
.toast-error   { background: #991b1b; color: #fff; }
.toast-warning { background: #92400e; color: #fff; }
.toast-info    { background: #1e3a5f; color: #fff; }
@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

/* === 卡片悬浮 === */
.card-hover {
    transition: all 0.2s ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

/* === 加载骨架屏 === */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease infinite;
    border-radius: 4px;
}
@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === 自定义滚动条 === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* === 移动端优化 === */
@media (max-width: 768px) {
    .mobile-full { width: 100% !important; }
    .mobile-stack { flex-direction: column !important; }
    .mobile-hide { display: none !important; }
}

/* === 打印样式 === */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; }
    .print-only { display: block !important; }
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #9ca3af;
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* === 标签/徽章 === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* === 统计卡片数值动画 === */
.stat-number {
    font-variant-numeric: tabular-nums;
    transition: all 0.3s ease;
}

/* === ECharts 容器 === */
.chart-container {
    min-height: 300px;
    width: 100%;
}

/* === 响应式表格包装 === */
@media (max-width: 640px) {
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }
    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .table-responsive td {
        position: relative;
        padding-left: 50%;
        white-space: normal;
        text-align: right;
    }
    .table-responsive td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        width: 45%;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: #6b7280;
    }
}
