/* GMV Monitor Dashboard 样式 */

/* 自定义颜色 */
.text-purple {
    color: #9c27b0 !important;
}

.text-roi-red {
    color: #dc3545 !important;
}

.text-roi-yellow {
    color: #ffc107 !important;
}

.text-roi-green {
    color: #28a745 !important;
}

body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.main-content {
    margin-top: 70px;
    padding: 20px;
}

/* 侧边栏 */
.sidebar {
    position: sticky;
    top: 70px;
    height: calc(100vh - 90px);
}

.sidebar .card {
    height: 100%;
}

.shop-list {
    overflow-y: auto;
    max-height: calc(100vh - 150px);
}

.shop-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.shop-item:hover {
    background-color: #f8f9fa;
}

.shop-item.active {
    background-color: #007bff;
    color: white;
}

.shop-item.active i {
    color: white;
}

.shop-item i {
    color: #6c757d;
    font-size: 1.1rem;
}

/* 主内容区 */
.main-area {
    padding-left: 15px;
}

/* 统计卡片 */
.stats-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.stats-card .card-body {
    padding: 18px 12px;
}

.stats-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.stats-card .card-title {
    font-size: 0.8rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.stats-card .card-title i {
    font-size: 0.9rem;
}

/* 告警盒子 */
.alert-box {
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.alert-box i {
    font-size: 2rem;
}

.alert-box .alert-count {
    font-size: 2.5rem;
    font-weight: 700;
}

.alert-box .alert-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.alert-red {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
}

.alert-yellow {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: #333;
}

.alert-green {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

/* 卡片通用样式 */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    padding: 15px 20px;
}

/* 告警列表 */
.alert-list {
    max-height: 350px;
    overflow-y: auto;
}

.alert-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-item .alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-item .alert-icon.red {
    background-color: #ffebee;
    color: #dc3545;
}

.alert-item .alert-icon.yellow {
    background-color: #fff8e1;
    color: #ffc107;
}

.alert-item .alert-icon.green {
    background-color: #e8f5e9;
    color: #28a745;
}

.alert-item .alert-content {
    flex: 1;
    min-width: 0;
}

.alert-item .alert-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-item .alert-message {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-item .alert-time {
    font-size: 0.75rem;
    color: #999;
    flex-shrink: 0;
}

/* 表格样式 */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* 状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.red {
    background-color: #ffebee;
    color: #dc3545;
}

.status-badge.yellow {
    background-color: #fff8e1;
    color: #d4a100;
}

.status-badge.green {
    background-color: #e8f5e9;
    color: #28a745;
}

.status-badge.normal {
    background-color: #f5f5f5;
    color: #666;
}

/* ROI 颜色 */
.roi-value {
    font-weight: 600;
}

.roi-value.good {
    color: #28a745;
}

.roi-value.warning {
    color: #ffc107;
}

.roi-value.danger {
    color: #dc3545;
}

/* 自动刷新指示器 */
.auto-refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
}

.auto-refresh-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 响应式 */
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
        margin-top: 60px;
    }
    
    .stats-card h2 {
        font-size: 1.2rem;
    }
    
    .alert-box .alert-count {
        font-size: 1.5rem;
    }
    
    .alert-box .alert-label {
        font-size: 0.75rem;
    }
}

/* ==================== 移动端适配 ==================== */

/* 导航栏移动端 */
@media (max-width: 992px) {
    .navbar .navbar-brand small {
        display: none; /* 隐藏口号 */
    }
    
    .navbar .navbar-nav {
        display: none; /* 隐藏水平导航 */
    }
    
    .navbar #update-time {
        display: none; /* 隐藏更新时间 */
    }
    
    /* 显示汉堡菜单按钮 */
    .navbar .mobile-menu-btn {
        display: inline-block !important;
    }
    
    /* 导航栏高度调整 */
    .navbar {
        padding: 8px 12px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

/* 侧边栏移动端 */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 80%;
        max-width: 280px;
        height: calc(100vh - 56px);
        z-index: 1040;
        transition: left 0.3s ease;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar .card {
        border-radius: 0;
        box-shadow: none;
    }
    
    .main-area {
        width: 100% !important;
        padding-left: 0 !important;
    }
    
    .main-area.col-md-10 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* 侧边栏遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

/* 统计卡片移动端 */
@media (max-width: 768px) {
    .stats-card {
        margin-bottom: 0;
    }
    
    .stats-card .card-body {
        padding: 12px 8px;
    }
    
    .stats-card .card-title {
        font-size: 0.65rem;
        margin-bottom: 6px;
        white-space: nowrap;
    }
    
    .stats-card .card-title i {
        font-size: 0.7rem;
    }
    
    .stats-card h2 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .stats-card .card-body {
        padding: 10px 5px;
    }
    
    .stats-card .card-title {
        font-size: 0.6rem;
    }
    
    .stats-card h2 {
        font-size: 0.95rem;
    }
}

/* 告警盒子移动端 */
@media (max-width: 768px) {
    .alert-box {
        padding: 15px 10px;
    }
    
    .alert-box i {
        font-size: 1.5rem;
    }
    
    .alert-box .alert-count {
        font-size: 1.5rem;
    }
    
    .alert-box .alert-label {
        font-size: 0.7rem;
    }
    
    .row .col-md-4 {
        margin-bottom: 10px;
    }
}

/* 表格移动端 */
@media (max-width: 992px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th, .table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    /* 隐藏部分列 */
    .table .hide-mobile {
        display: none;
    }
}

/* 趋势图移动端 */
@media (max-width: 992px) {
    .row .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .row .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* 日期选择器移动端 */
@media (max-width: 768px) {
    .date-picker-dropdown {
        width: 100%;
        left: 0;
        right: 0;
        position: fixed;
        top: auto;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
    }
    
    .date-picker-container {
        flex-direction: column;
    }
    
    .date-shortcuts {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        display: flex;
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .shortcut-item {
        flex: 1;
        text-align: center;
        padding: 10px 5px;
    }
    
    .date-calendars {
        padding: 15px;
    }
    
    .calendar-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .calendar-inputs input {
        width: 100%;
    }
    
    .date-range-display {
        font-size: 0.8rem;
        padding: 5px 10px;
        min-width: 80px;
    }
}

/* 移动端店铺选择器 */
.mobile-shop-selector {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    padding: 12px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.mobile-shop-selector select {
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    width: 100%;
    cursor: pointer;
}

.mobile-shop-selector select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5);
}

/* 卡片头部移动端 */
@media (max-width: 768px) {
    .card-header {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .card-header .d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-header .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* 模态框移动端 */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-lg {
        max-width: calc(100% - 20px);
    }
}

/* 操作建议移动端 */
@media (max-width: 768px) {
    .suggestion-item {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* 登录页面移动端 */
@media (max-width: 480px) {
    .login-container {
        margin: 10px;
        padding: 30px 20px;
    }
}

/* 移动端底部导航 */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1030;
    padding: 8px 0;
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 992px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
    }
    
    .mobile-bottom-nav .nav-item {
        flex: 1;
        text-align: center;
    }
    
    .mobile-bottom-nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #6c757d;
        font-size: 0.7rem;
        padding: 5px;
        text-decoration: none;
    }
    
    .mobile-bottom-nav .nav-link i {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }
    
    .mobile-bottom-nav .nav-link.active {
        color: #007bff;
    }
    
    /* 主内容区域给底部导航留出空间 */
    .main-content {
        padding-bottom: 70px;
    }
}

/* 店铺列表移动端 */
@media (max-width: 992px) {
    .shop-list {
        max-height: calc(100vh - 120px);
    }
    
    .shop-item {
        padding: 15px;
        font-size: 0.95rem;
    }
}

/* 用户下拉菜单移动端 */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 150px;
    }
}

/* 触摸友好 */
@media (max-width: 992px) {
    .btn {
        min-height: 38px;
    }
    
    .btn-sm {
        min-height: 32px;
    }
    
    .form-control, .form-select {
        min-height: 38px;
    }
}

/* 数据加载中 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}

.loading::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* 操作建议区域 */
.suggestion-item {
    padding: 10px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid #007bff;
}

.suggestion-item:last-child {
    margin-bottom: 0;
}

#suggestions-container {
    min-height: 60px;
}

/* 趋势箭头 */
.stats-card h2 span {
    font-size: 1rem;
    margin-left: 5px;
}

/* 日期范围选择器 */
.date-range-picker {
    position: relative;
    display: inline-block;
}

.date-range-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    min-width: 100px;
    transition: all 0.2s;
}

.date-range-display:hover {
    border-color: #00b578;
    box-shadow: 0 0 0 2px rgba(0, 181, 120, 0.1);
}

.date-range-display i {
    color: #6c757d;
}

.date-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    width: 340px;
}

.date-picker-dropdown.show {
    display: block;
}

.date-picker-container {
    display: flex;
    flex-direction: row;
}

.date-shortcuts {
    width: 90px;
    border-right: 1px solid #eee;
    padding: 10px 0;
    flex-shrink: 0;
}

.shortcut-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #333;
    transition: all 0.2s;
    white-space: nowrap;
}

.shortcut-item:hover {
    background: #f5f5f5;
    color: #00b578;
}

.shortcut-item.active {
    background: rgba(0, 181, 120, 0.1);
    color: #00b578;
    font-weight: 500;
}

.date-calendars {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calendar-inputs {
    display: flex;
    align-items: center;
    gap: 5px;
}

.calendar-inputs input {
    width: 110px;
    font-size: 0.8rem;
}

.calendar-inputs span {
    font-size: 0.8rem;
    color: #666;
}

.date-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* 点击外部关闭 */
.date-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

/* 广告计划展开/收起 */
.toggle-detail-btn {
    color: #6c757d;
    transition: transform 0.2s;
}

.toggle-detail-btn:hover {
    color: #0d6efd;
}

.toggle-detail-btn i {
    transition: transform 0.2s;
}

.campaign-detail-row {
    background-color: #f8f9fa;
}

.campaign-detail-content {
    border-top: 1px solid #dee2e6;
}

.campaign-detail-content table {
    margin: 0;
    font-size: 0.875rem;
}

.campaign-detail-content .table-secondary {
    background-color: #e9ecef;
}

/* 加载动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}
