/* ========================================
   乡伴·鱼跃 管理后台 样式
   ======================================== */

/* CSS Variables */
:root {
    --primary-color: #6A9C89;
    --primary-dark: #4A7C69;
    --primary-light: #E8F0EE;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --topnav-height: 60px;
    --border-color: #E8E8E8;
    --bg-color: #F5F7FA;
    --text-color: #333;
    --text-light: #666;
    --danger-color: #E53935;
    --warning-color: #FF9800;
    --success-color: #4CAF50;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--text-color);
    background: var(--bg-color);
}

/* Page Container */
.page-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Left Sidebar
   ======================================== */
.left-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #2C3E50 0%, #1a252f 100%);
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    transition: width 0.3s ease;
    z-index: 1000;
}

.left-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: 500;
}

/* Navigation */
.sidebar-nav {
    padding: 10px 0;
}

.nav-group {
    margin-bottom: 5px;
}

.nav-group-title {
    padding: 10px 20px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link i {
    width: 24px;
    font-size: 16px;
    margin-right: 12px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-link.active {
    border-left: 3px solid var(--primary-color);
    background: rgba(106, 156, 137, 0.2);
}

/* ========================================
   Right Content
   ======================================== */
.right-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.right-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

/* Top Navigation */
.top-nav {
    height: var(--topnav-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
}

.sidebar-toggle:hover {
    background: var(--bg-color);
}

.page-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info .username {
    font-weight: 500;
}

.user-info .role-tag {
    padding: 2px 8px;
    background: var(--primary-color);
    color: #fff;
    font-size: 12px;
    border-radius: 10px;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s ease;
}

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

.logout-btn:hover {
    color: var(--danger-color);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    padding: 24px;
}

/* ========================================
   Cards & Stats
   ======================================== */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 16px;
}

.stat-icon.users { background: #E3F2FD; color: #1976D2; }
.stat-icon.orders { background: #FFF3E0; color: #F57C00; }
.stat-icon.products { background: #E8F5E9; color: #388E3C; }
.stat-icon.income { background: #FCE4EC; color: #C2185B; }

.stat-info h4 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-light);
}

/* ========================================
   Content Panel
   ======================================== */
.content-panel {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.panel-body {
    padding: 20px;
}

/* ========================================
   Tables
   ======================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-color);
    font-weight: 500;
    color: var(--text-light);
    font-size: 13px;
}

.data-table tbody tr:hover {
    background: var(--bg-color);
}

.data-table .img-thumb {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 6px;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

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

.btn-secondary {
    background: #fff;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

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

.btn-danger:hover {
    background: #C62828;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-label.required::after {
    content: '*';
    color: var(--danger-color);
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

/* ========================================
   Tags & Badges
   ======================================== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.tag-success { background: #E8F5E9; color: #388E3C; }
.tag-warning { background: #FFF3E0; color: #F57C00; }
.tag-danger { background: #FFEBEE; color: #C62828; }
.tag-info { background: #E3F2FD; color: #1976D2; }

/* ========================================
   Pagination
   ======================================== */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
}

.pagination-info {
    margin-right: 16px;
    color: var(--text-light);
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination a.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ========================================
   Search Bar
   ======================================== */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar .form-control {
    width: auto;
    flex: 1;
    min-width: 200px;
}

.search-bar .btn {
    flex-shrink: 0;
}

/* ========================================
   Login Page
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6A9C89 0%, #4A7C69 100%);
}

.login-box {
    width: 400px;
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
}

.login-logo h2 {
    font-size: 24px;
    color: var(--text-color);
}

.login-error {
    background: #FFEBEE;
    color: var(--danger-color);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .left-sidebar {
        transform: translateX(-100%);
    }

    .left-sidebar.show {
        transform: translateX(0);
    }

    .right-content {
        margin-left: 0;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .top-nav {
        padding: 0 16px;
    }

    .main-content {
        padding: 16px;
    }

    .login-box {
        width: 100%;
        margin: 0 16px;
    }
}
