/* ============================================
   Toyota Admin - 全局样式 & 后台布局
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --toyota-red: #DC0A2D;
    --toyota-red-dark: #B00820;
    --toyota-red-light: #E8304D;
    --toyota-red-glow: rgba(220, 10, 45, 0.6);

    --sidebar-width: 220px;
    --sidebar-collapsed: 60px;
    --header-height: 56px;

    --bg-dark: #1a1a2e;
    --bg-sidebar: #16213e;
    --bg-content: #f0f2f5;
    --bg-card: #ffffff;

    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-white: #ffffff;

    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    --red: #DC0A2D;
    --blue: #3b82f6;
    --green: #10b981;
    --orange: #f59e0b;
    --purple: #8b5cf6;
}

/* ---------- 全局重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    width: 100%; height: 100%;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-content);
    overflow: hidden;
}

a { color: var(--toyota-red); text-decoration: none; }
a:hover { color: var(--toyota-red-light); }

/* ============================================
   登录页
   ============================================ */
.login-container {
    width: 100%;
    height: 100vh;
    background: url('/static/images/login_bg.png') center center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 0;
}

/* 登录框 */
.login-box {
    position: relative;
    z-index: 1;
    width: 420px;
    padding: 40px 36px 36px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(220, 10, 45, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(220, 10, 45, 0.08) inset;
}

/* Logo 区域 + 动态光晕 */
.login-logo { text-align: center; margin-bottom: 28px; }

.login-logo .logo-icon {
    position: relative;
    display: inline-block;
    width: 180px;
    height: 180px;
    margin-bottom: 12px;
}

.login-logo .logo-icon img {
    position: relative;
    z-index: 2;
    display: block;
    width: 180px;
    height: auto;
    margin: 0 auto;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50%;
    object-fit: contain;
    padding: 8px;
}

/* 红色光晕 - 第一层 */
.login-logo .logo-icon::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    z-index: 3;
    width: 120px; height: 75px;
    margin: -37.5px 0 0 -60px;
    border-radius: 50%;
    background: rgba(220, 10, 45, 0.08);
    box-shadow: 0 0 25px 6px rgba(220, 10, 45, 0.55),
                0 0 50px 12px rgba(220, 10, 45, 0.35),
                0 0 80px 20px rgba(220, 10, 45, 0.18);
    animation: glowPulse1 2s ease-in-out infinite;
}

/* 红色光晕 - 第二层 */
.login-logo .logo-icon::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    z-index: 4;
    width: 120px; height: 75px;
    margin: -37.5px 0 0 -60px;
    border-radius: 50%;
    background: rgba(220, 10, 45, 0.05);
    box-shadow: 0 0 35px 10px rgba(220, 10, 45, 0.45),
                0 0 70px 18px rgba(220, 10, 45, 0.25),
                0 0 100px 28px rgba(220, 10, 45, 0.12);
    animation: glowPulse2 2s ease-in-out infinite 0.5s;
}

@keyframes glowPulse1 {
    0%, 100% {
        box-shadow: 0 0 30px 8px rgba(220, 10, 45, 0.5),
                    0 0 60px 16px rgba(220, 10, 45, 0.3),
                    0 0 90px 24px rgba(220, 10, 45, 0.15);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 45px 12px rgba(220, 10, 45, 0.65),
                    0 0 80px 22px rgba(220, 10, 45, 0.4),
                    0 0 110px 30px rgba(220, 10, 45, 0.2);
        transform: scale(1.15);
    }
}

@keyframes glowPulse2 {
    0%, 100% {
        box-shadow: 0 0 40px 12px rgba(220, 10, 45, 0.4),
                    0 0 80px 24px rgba(220, 10, 45, 0.2),
                    0 0 120px 36px rgba(220, 10, 45, 0.1);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 55px 16px rgba(220, 10, 45, 0.55),
                    0 0 100px 30px rgba(220, 10, 45, 0.3),
                    0 0 140px 42px rgba(220, 10, 45, 0.15);
        transform: scale(1.2);
    }
}

.login-logo h2 {
    font-size: 20px;
    color: #fff;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.login-logo p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* 登录表单 */
.login-form { width: 100%; }

.login-form .layui-form-item {
    margin-bottom: 18px;
}

.login-form .layui-input-wrap {
    position: relative;
}

.login-form .layui-input {
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    padding-left: 40px;
    font-size: 14px;
    transition: all 0.3s;
}

.login-form .layui-input:focus {
    border-color: var(--toyota-red);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(220, 10, 45, 0.15);
}

.login-form .layui-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-form .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    z-index: 1;
    pointer-events: none;
}

/* 验证码行 */
.captcha-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.captcha-row .layui-input-wrap {
    flex: 1;
}

.captcha-row .captcha-img {
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* 登录按钮 */
.login-btn {
    width: 100%;
    height: 44px;
    border: none;
    outline: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--toyota-red) 0%, var(--toyota-red-dark) 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(220, 10, 45, 0.4);
}

.login-btn:hover {
    background: linear-gradient(135deg, var(--toyota-red-light) 0%, var(--toyota-red) 100%);
    box-shadow: 0 6px 20px rgba(220, 10, 45, 0.55);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 10, 45, 0.3);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(220, 10, 45, 0.2);
}

/* ============================================
   后台布局 - Admin Wrap
   ============================================ */
.admin-wrap {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* ---------- 侧边栏 Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-sidebar) 100%);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
    overflow: hidden;
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Sidebar Logo */
.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-logo img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    opacity: 1;
    transition: opacity 0.3s;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
}

/* Sidebar 菜单滚动区 */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* Layui 导航覆盖 */
.sidebar .layui-nav {
    background: transparent;
    border-radius: 0;
}

.sidebar .layui-nav-item > a {
    color: rgba(255, 255, 255, 0.75);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    height: 48px;
    line-height: 48px;
}

.sidebar .layui-nav-item > a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar .layui-nav-itemed > a {
    color: #fff !important;
    background: transparent !important;
    border-left: none;
}

/* 只有没有子菜单的一级菜单选中时才变红色 */
.sidebar .layui-nav-tree .layui-nav-item.layui-this > a {
    color: #fff !important;
    background: var(--toyota-red) !important;
    border-left: 3px solid var(--toyota-red-light);
}

/* 子菜单选中项 */
.sidebar .layui-nav-tree .layui-nav-child dd.layui-this > a {
    color: #fff !important;
    background: var(--toyota-red) !important;
    border-left: 3px solid var(--toyota-red-light);
}

/* 覆盖 Layui 的 li 级别背景色 */
.sidebar .layui-nav-tree .layui-nav-item.layui-this,
.sidebar .layui-nav-tree .layui-nav-child dd.layui-this {
    background: transparent !important;
}

/* 覆盖 Layui 默认的绿色 hover 滑块 */
.sidebar .layui-nav-bar {
    background: var(--toyota-red) !important;
}

.sidebar .layui-nav-child {
    background: rgba(0, 0, 0, 0.2);
}

.sidebar .layui-nav-child dd > a {
    color: rgba(255, 255, 255, 0.6);
    padding-left: 52px !important;
    display: flex;
    align-items: center;
    height: 40px;
    line-height: 40px;
}

.sidebar .layui-nav-child dd > a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar .layui-nav .layui-icon {
    margin-right: 8px;
    font-size: 16px;
}

.sidebar.collapsed .layui-nav-item > a cite,
.sidebar.collapsed .layui-nav-child {
    display: none;
}

/* ---------- 主内容区 Main Wrap ---------- */
.main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
}

/* ---------- 顶栏 Header ---------- */
.header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.collapse-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 18px;
}

.collapse-btn:hover {
    background: var(--bg-content);
    color: var(--toyota-red);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.header-badge {
    position: relative;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 20px;
}

.header-badge .badge-num {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    border-radius: 8px;
    padding: 0 4px;
}

/* 用户信息 */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-info:hover {
    background: var(--bg-content);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--toyota-red), var(--toyota-red-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-arrow {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

/* 下拉面板 */
.drop-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: 6px 0;
    display: none;
    z-index: 200;
    border: 1px solid var(--border-color);
}

.drop-panel.show {
    display: block;
}

.drop-panel a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.drop-panel a:hover {
    background: var(--bg-content);
    color: var(--toyota-red);
}

.drop-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ---------- 内容区 Content ---------- */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-content);
}

.content::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 3px;
}

/* ---------- 统计卡片 Stats ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    border: 1px solid transparent;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.red {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #dc2626;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #bfdbfe, #93c5fd);
    color: #2563eb;
}

.stat-icon.green {
    background: linear-gradient(135deg, #a7f3d0, #6ee7b7);
    color: #059669;
}

.stat-icon.orange {
    background: linear-gradient(135deg, #fed7aa, #fdba74);
    color: #d97706;
}

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------- 双列布局 Grid ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ---------- 卡片 Card ---------- */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

/* ---------- 表格容器 ---------- */
.table-wrap {
    padding: 0 0 10px 0;
    overflow-x: auto;
}

.table-wrap .layui-table {
    margin: 0;
    width: 100%;
}

.table-wrap .layui-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: #f9fafb;
    border-bottom: 2px solid var(--border-color);
    padding: 12px 16px;
    font-size: 13px;
}

.table-wrap .layui-table td {
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
}

.table-wrap .layui-table tr:hover td {
    background: #fafbfc;
}

/* ---------- 标签 Tag ---------- */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.tag-success {
    background: #d1fae5;
    color: #065f46;
}

.tag-info {
    background: #dbeafe;
    color: #1e40af;
}

.tag-danger {
    background: #fee2e2;
    color: #991b1b;
}

.tag-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ---------- 文字省略 ---------- */
.ellipsis {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* ============================================
   通用表单/列表页面样式
   ============================================ */

/* 页面容器 */
.page-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.search-bar .layui-form-label {
    width: auto;
    padding: 0 0 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.search-bar .layui-input-block {
    margin-left: 0;
}

.search-bar .layui-input,
.search-bar .layui-form-select .layui-input {
    height: 36px;
    border-radius: 6px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.toolbar-left {
    display: flex;
    gap: 8px;
}

.toolbar-right {
    display: flex;
    gap: 8px;
}

/* 表格容器（全宽） */
.table-container {
    overflow-x: auto;
}

/* 分页 */
.pagination-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Layui 按钮覆盖 */
.layui-btn {
    border-radius: 6px;
    font-size: 13px;
    height: 36px;
    line-height: 36px;
    padding: 0 16px;
}

.layui-btn-primary {
    border-color: var(--border-color);
    color: var(--text-primary);
}

.layui-btn-primary:hover {
    border-color: var(--toyota-red);
    color: var(--toyota-red);
}

.layui-btn-danger {
    background: var(--toyota-red);
    border-color: var(--toyota-red);
}

.layui-btn-danger:hover {
    background: var(--toyota-red-dark);
    border-color: var(--toyota-red-dark);
}

/* Layui 表单覆盖 */
.layui-form-label {
    width: 90px;
}

.layui-input-block {
    margin-left: 120px;
}

.layui-form-select dl dd.layui-this {
    background: var(--toyota-red);
}

/* 操作列按钮 */
.btn-xs {
    height: 28px;
    line-height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .layui-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 14px;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 1200px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -220px;
        transition: left 0.3s;
    }
    .sidebar.show {
        left: 0;
    }
    .stats {
        grid-template-columns: 1fr;
    }
    .content {
        padding: 12px;
    }
    .header {
        padding: 0 12px;
    }
    .login-box {
        width: 90%;
        padding: 30px 20px;
    }
}

/* ============================================
   Toast 提示
   ============================================ */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show {
    opacity: 1;
}
.toast-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}
.toast-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}
