/* Modern Theme for Magistv Admin - Inspired by Shadcn UI */

:root {
    --primary-color: #0f172a;
    --primary-foreground: #ffffff;
    --background: #ffffff;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #0f172a;
    --radius: 0.75rem;
    --sidebar-bg: #ffffff;
    --sidebar-foreground: #64748b;
    --sidebar-active-bg: #f1f5f9;
    --sidebar-active-foreground: #0f172a;
    --header-bg: #ffffff;
    --header-height: 64px;
}

body {
    background-color: var(--background);
    color: var(--card-foreground);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* Sidebar Styles Overrides */
.left-menu {
    width: 290px !important;
    background: #fcfcfc !important; /* Slightly off-white background from image */
    border-right: 1px solid var(--border) !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1000 !important;
    padding: 0 !important;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.sidebar-header-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-section-label {
    padding: 24px 24px 8px 24px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: none;
    letter-spacing: 0.02em;
}

.el-menu {
    border-right: none !important;
    background-color: transparent !important;
}

.el-menu-item, .el-submenu__title {
    height: 40px !important;
    line-height: 40px !important;
    margin: 2px 12px !important;
    border-radius: 8px !important;
    color: #64748b !important;
    transition: all 0.2s ease !important;
    font-size: 14px !important;
    padding-left: 12px !important;
}

.el-menu-item i, .el-submenu__title i {
    color: #64748b !important;
    margin-right: 12px !important;
    font-size: 18px !important;
    width: 20px;
    text-align: center;
}

.el-menu-item:hover, .el-submenu__title:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

.el-menu-item.is-active {
    background-color: #e2e8f0 !important; /* Light gray active background from image */
    color: #0f172a !important;
    font-weight: 500 !important;
}

.el-menu-item.is-active i {
    color: #0f172a !important;
}

/* Badge Styles */
.menu-badge {
    float: right;
    margin-top: 10px;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.menu-badge.new {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.menu-badge.count {
    color: #64748b;
    font-weight: 400;
}

.el-submenu .el-menu-item {
    margin-left: 24px !important;
    margin-right: 12px !important;
    min-width: auto !important;
}

.el-submenu__icon-arrow {
    right: 12px !important;
}

/* Header Styles Overrides */
header {
    height: var(--header-height) !important;
    background: var(--header-bg) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: none !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: 290px !important;
    width: auto !important;
    z-index: 999 !important;
}

.header-container {
    padding: 0 32px !important;
}

.header-title {
    color: var(--primary-color) !important;
    font-weight: 600 !important;
}

.logo {
    height: 32px !important;
}

/* Main Content Styles */
.right-content {
    margin-left: 290px !important;
    width: calc(100% - 290px) !important;
    padding: calc(var(--header-height) + 20px) 20px 20px 20px !important;
    background-color: var(--background) !important;
    min-height: 100vh !important;
    box-sizing: border-box !important;
    transition: margin-left 0.25s ease, width 0.25s ease;
}

/* Card Styles */
.stat-card, .chart-card, .table-card {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    /* box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important; */
    padding: 10px !important;
    height: 100%;
    box-sizing: border-box !important;
    transition: transform 280ms cubic-bezier(.2,.8,.2,1), box-shadow 280ms cubic-bezier(.2,.8,.2,1) !important;
    border-radius: 10px;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

/* 真正的 3D 翻面（正反两面） */
.stat-card.stat-card-flip {
    padding: 0 !important;
    perspective: 900px;
    transform-style: preserve-3d;
}

.stat-card.stat-card-flip .stat-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.stat-card.stat-card-flip .stat-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 140px;
    transform-style: preserve-3d;
    transition: transform 600ms cubic-bezier(.2,.8,.2,1);
}

.stat-card.stat-card-flip:hover .stat-card-inner {
    transform: rotateY(180deg);
}

.stat-card.stat-card-flip .stat-card-face {
    position: absolute;
    inset: 0;
    padding: 10px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card.stat-card-flip .stat-card-front {
    transform: rotateY(0deg);
}

.stat-card.stat-card-flip .stat-card-back {
    transform: rotateY(180deg);
    background: #0f172a;
    color: #ffffff;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.stat-card.stat-card-flip .stat-card-back .back-title {
    font-size: 16px;
    font-weight: 600;
    opacity: 0.95;
}

.stat-card.stat-card-flip .stat-card-back .back-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    opacity: 0.9;
}

.stat-card.stat-card-flip .stat-card-back .back-action i {
    font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .stat-card, .chart-card, .table-card {
        transition: none !important;
    }
    .stat-card:hover {
        transform: translateY(-2px) !important;
    }
}

.menu-card .el-col {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

/* Statistic Overrides */
.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    color: #64748b;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    color: #1e293b;
    font-size: 30px;
    font-weight: 700;
    margin: 8px 0;
    letter-spacing: -0.02em;
}

.stat-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-top: 4px;
}

.stat-footer .trend {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-footer .trend.up {
    color: #ef4444;
}

.stat-footer .trend.down {
    color: #10b981;
}

.stat-footer .text {
    color: #64748b;
}

.el-statistic .head .title {
    color: #64748b !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    margin-bottom: 8px !important;
}

.el-statistic .con .number {
    color: #0f172a !important;
    font-size: 24px !important;
    font-weight: 700 !important;
}

/* Table Overrides */
.el-table {
    border-radius: var(--radius) !important;
    overflow: hidden !important;
}

.el-table th {
    background-color: #f8fafc !important;
    color: #64748b !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    font-size: 12px !important;
    letter-spacing: 0.05em !important;
}

.el-table td {
    padding: 12px 0 !important;
}

/* Button Overrides - Modern Shadcn Style */
.el-button {
    border-radius: 8px !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    transition: all 0.2s ease !important;
    font-size: 13px !important;
}

.el-button--small {
    padding: 8px 12px !important;
    font-size: 12px !important;
}

.el-button--mini { 
    font-size: 11px !important;
}

/* Primary Button - Dark */
.el-button--primary {
    background-color: #0f172a !important;
    border-color: #0f172a !important;
    color: #ffffff !important;
}

.el-button--primary:hover, .el-button--primary:focus {
    background-color: #1e293b !important;
    border-color: #1e293b !important;
}

/* Success Button - Green */
.el-button--success {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
}

.el-button--success:hover, .el-button--success:focus {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

/* Danger Button - Red */
.el-button--danger {
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
}

.el-button--danger:hover, .el-button--danger:focus {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* Info Button - Gray */
.el-button--info {
    background-color: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
}

.el-button--info:hover, .el-button--info:focus {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Warning Button - Orange */
.el-button--warning {
    background-color: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #ffffff !important;
}

/* Default Button */
.el-button--default {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}

.el-button--default:hover {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

/* Tag buttons or status buttons inside table */
.tag-read {
    border: none !important;
    box-shadow: none !important;
}

/* Fix specific spacing in forms */
.el-form-item__content .el-button {
    margin-right: 8px;
}

/* Chart Header Modern */
.chart-header-modern {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin: -24px -24px 24px -24px;
    padding: 20px 24px;
}

.chart-header-modern .title-section h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.chart-header-modern .title-section p {
    margin: 4px 0 0 0;
    font-size: 14px;
    color: #64748b;
}

.chart-header-modern .stats-section {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.chart-header-modern .stat-block {
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: #f8fafc;
}

.chart-header-modern .stat-block:first-child {
    border-right: 1px solid var(--border);
}

.chart-header-modern .stat-block .label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.chart-header-modern .stat-block .value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

/* Chart Container */
.chart-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.chart-header i {
    font-size: 20px;
}
@media (max-width: 1200px) {
/* Responsive adjustments */
@media (max-width: 768px) {
    .left-menu {
        width: 80px !important;
    }
    .left-menu .header-title, .left-menu span, .menu-section-label {
        display: none !important;
    }
    .sidebar-header {
        padding: 20px 0 !important;
        justify-content: center !important;
    }
    .sidebar-header i {
        display: none !important; /* Hide the sort icon */
    }
    header, .right-content {
        left: 80px !important;
        margin-left: 80px !important;
    }
    .el-submenu__icon-arrow {
        display: none !important;
    }
    .el-menu-item i, .el-submenu__title i {
        margin-right: 0 !important;
    }
    .el-menu-item, .el-submenu__title {
        padding: 0 !important;
        display: flex !important;
        justify-content: center !important;
    }
}

/* Desktop collapse (click top-right icon) */
.left-menu {
    transition: width 0.25s ease;
}

header {
    transition: left 0.25s ease;
}

body.sidebar-collapsed .left-menu {
    width: 80px !important;
}

body.sidebar-collapsed header {
    left: 80px !important;
}

body.sidebar-collapsed .right-content {
    margin-left: 80px !important;
    width: calc(100% - 80px) !important;
}

body.sidebar-collapsed .menu-section-label,
body.sidebar-collapsed .left-menu span {
    display: none !important;
}

body.sidebar-collapsed .el-submenu__icon-arrow {
    display: none !important;
}

body.sidebar-collapsed .el-menu-item i,
body.sidebar-collapsed .el-submenu__title i {
    margin-right: 0 !important;
}

body.sidebar-collapsed .el-menu-item,
body.sidebar-collapsed .el-submenu__title {
    padding: 0 !important;
    display: flex !important;
    justify-content: center !important;
}
}