/**
 * 喵呜小手机 - 基础样式
 * 重置样式、全局样式、通用类
 */

/* ========== 重置样式 ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: linear-gradient(to bottom, var(--background-start), var(--background-end));
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-gray);
}

/* ========== 应用容器 ========== */
#app {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    height: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    background: var(--card-background);
}

/* 桌面端显示为手机样式 */
@media (min-width: 501px) {
    .app-container {
        height: 90vh;
        max-height: 900px;
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
    }
}

.main-app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ========== 加载界面 ========== */
.loading-screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-lg);
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-content p {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

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

/* ========== 弹窗层 ========== */
.modal-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
}

/* ========== 通用动画 ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

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

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ========== 通用工具类 ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-gray { color: var(--text-gray); }
.text-light { color: var(--text-light); }
.text-danger { color: var(--text-danger); }
.text-success { color: var(--color-success); }

.font-bold { font-weight: 600; }
.font-normal { font-weight: 400; }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { justify-content: center; align-items: center; }
.flex-between { justify-content: space-between; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 头像通用样式 ========== */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--background-gray);
    flex-shrink: 0;
}

.avatar-sm { width: var(--avatar-sm); height: var(--avatar-sm); }
.avatar-md { width: var(--avatar-md); height: var(--avatar-md); }
.avatar-lg { width: var(--avatar-lg); height: var(--avatar-lg); }
.avatar-xl { width: var(--avatar-xl); height: var(--avatar-xl); }

/* ========== 按钮基础样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    -webkit-appearance: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--theme-primary);
    color: var(--text-on-primary);
}

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

.btn-secondary {
    background-color: var(--background-gray);
    color: var(--text-dark);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-md);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

/* ========== 输入框基础样式 ========== */
.input {
    width: 100%;
    padding: var(--spacing-md);
    font-size: var(--font-size-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: white;
    transition: border-color var(--transition-fast);
    outline: none;
}

.input:focus {
    border-color: var(--theme-primary);
}

.input::placeholder {
    color: var(--text-light);
}

.textarea {
    resize: vertical;
    min-height: 100px;
}

/* ========== 卡片样式 ========== */
.card {
    background-color: var(--card-background-solid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-body {
    padding: var(--spacing-lg);
}

/* ========== 分割线 ========== */
.divider {
    height: 1px;
    background-color: var(--divider-color);
    margin: var(--spacing-md) 0;
}

/* ========== 空状态 ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxl);
    text-align: center;
    color: var(--text-gray);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: var(--spacing-lg);
    opacity: 0.5;
}

.empty-state p {
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-sm);
}
