/* ========================================
   律师工具箱 - 基础样式
   ======================================== */

/* Remix Icon 图标库 */
@import url("https://cdn.jsdelivr.net/npm/remixicon@4.6.0/fonts/remixicon.css");

/* CSS变量定义 */
:root {
    /* 主色调 */
    --primary: #4A5568;
    --primary-light: #718096;
    --primary-dark: #2D3748;

    /* 背景色 */
    --bg-main: #F7FAFC;
    --bg-card: #FFFFFF;
    --bg-hover: #EDF2F7;
    --bg-input: #FFFFFF;

    /* 文字色 */
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #A0AEC0;

    /* 边框与分割线 */
    --border: #E2E8F0;
    --divider: #EDF2F7;

    /* 功能色 */
    --success: #48BB78;
    --success-light: #C6F6D5;
    --warning: #ED8936;
    --warning-light: #FEEBC8;
    --info: #4299E1;
    --info-light: #BEE3F8;
    --error: #F56565;
    --error-light: #FED7D7;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* 间距 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* 字体 */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;

    /* 字号 */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* 行高 */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;

    /* 过渡 */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* 容器宽度 */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1200px;
}

/* ===== 全局动画 ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* 动画工具类 */
.anim-fade-in-up {
    animation: fadeInUp 0.4s ease both;
}
.anim-fade-in {
    animation: fadeIn 0.3s ease both;
}
.anim-scale-in {
    animation: scaleIn 0.3s ease both;
}

/* 交错延迟 */
.anim-stagger > *:nth-child(1) { animation-delay: 0ms; }
.anim-stagger > *:nth-child(2) { animation-delay: 40ms; }
.anim-stagger > *:nth-child(3) { animation-delay: 80ms; }
.anim-stagger > *:nth-child(4) { animation-delay: 120ms; }
.anim-stagger > *:nth-child(5) { animation-delay: 160ms; }
.anim-stagger > *:nth-child(6) { animation-delay: 200ms; }
.anim-stagger > *:nth-child(7) { animation-delay: 240ms; }
.anim-stagger > *:nth-child(8) { animation-delay: 280ms; }
.anim-stagger > *:nth-child(9) { animation-delay: 320ms; }
.anim-stagger > *:nth-child(10) { animation-delay: 360ms; }
.anim-stagger > *:nth-child(n+11) { animation-delay: 400ms; }

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-main);
    min-height: 100vh;
}

/* 链接 */
a {
    color: var(--info);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* 图片 */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 列表 */
ul, ol {
    list-style: none;
}

/* 表格 */
table {
    border-collapse: collapse;
    width: 100%;
}

/* 按钮重置 */
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* 输入框重置 */
input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ==================== 通用表单样式 ==================== */

/* 表单组 */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-label-hint {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: var(--spacing-xs);
}

/* 输入框 */
.form-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--text-base);
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px var(--info-light);
}

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

.form-input:disabled {
    background-color: var(--bg-hover);
    cursor: not-allowed;
}

/* 数字输入框 */
.form-input[type="number"] {
    font-family: var(--font-mono);
}

/* 日期输入框 */
.form-input[type="date"] {
    font-family: var(--font-mono);
}

/* 下拉选择框 */
.form-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--text-base);
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A5568' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px var(--info-light);
}

/* 复选框 */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-checkbox-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    user-select: none;
}

/* 单选框组 */
.form-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.form-radio {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
}

.form-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-radio-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    user-select: none;
}

/* 输入框附加单位 */
.input-with-unit {
    display: flex;
    align-items: stretch;
}

.input-with-unit .form-input {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    flex: 1;
}

.input-unit {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    background-color: var(--bg-hover);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* 标题 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

/* 段落 */
p {
    margin-bottom: var(--spacing-md);
}

p:last-child {
    margin-bottom: 0;
}

/* 选中文本 */
::selection {
    background-color: var(--info-light);
    color: var(--text-primary);
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

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

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

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 600; }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
