/* ===============================================
   战场环境探索系统 - 现代军事主题样式表
   Modern Military Theme for Battlefield Exploration System
   版本: v4.0 - Qt 5.15完全兼容版
   日期: 2024-07-03
   特点: 移除所有CSS3不兼容属性，优化学术演示效果
   =============================================== */

/* ========================================
   1. 全局配色系统 (Color System)
   ======================================== */

/*
   主色调 - 军事蓝色系
   注意：Qt不支持CSS变量，直接在样式中使用颜色值

   Primary Colors:
   - primary-dark: #0f1419      (最深背景)
   - primary-medium: #1a252f    (中等背景)
   - primary-light: #2d3748     (浅背景)
   - primary-accent: #4a90e2    (主要强调色)

   Status Colors:
   - success-color: #27ae60     (成功/在线)
   - warning-color: #f39c12     (警告)
   - danger-color: #e74c3c      (危险/离线)
   - info-color: #3498db        (信息)

   Text Colors:
   - text-primary: #ffffff      (主要文字)
   - text-secondary: #e2e8f0    (次要文字)
   - text-muted: #95a5a6        (弱化文字)
*/

/* ========================================
   2. 全局基础样式
   ======================================== */

QWidget {
    background-color: #1e3a5f;
    color: #ffffff;
    font-family: "Microsoft YaHei", "SimHei", "Segoe UI", Arial, sans-serif;
    font-size: 13px;
    selection-background-color: #4a90e2;
    selection-color: #ffffff;
}

QMainWindow {
    background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
                stop:0 #0f1419, stop:1 #1a252f);
    border: none;
}

/* ========================================
   3. 现代化按钮系统
   ======================================== */

/* 主要按钮 - 蓝色系 */
QPushButton {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #4a90e2, stop:1 #2c5282);
    border: 2px solid #1e3a5f;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    min-height: 32px;
    min-width: 100px;
}

QPushButton:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #5ba0f2, stop:1 #4a90e2);
    border: 2px solid #4a90e2;
    border-bottom: 3px solid #2c5282;
}

QPushButton:pressed {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #2c5282, stop:1 #1e3a5f);
    border: 2px solid #1e3a5f;
    border-bottom: 1px solid #1e3a5f;
}

QPushButton:disabled {
    background: #4a5568;
    border: 2px solid #2d3748;
    color: #95a5a6;
}

/* 成功按钮 - 绿色系 */
QPushButton[class="success"] {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #27ae60, stop:1 #229954);
    border: 2px solid #1e8449;
}

QPushButton[class="success"]:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #58d68d, stop:1 #27ae60);
    border: 2px solid #27ae60;
    border-bottom: 3px solid #1e8449;
}

/* 危险按钮 - 红色系 */
QPushButton[class="danger"] {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #e74c3c, stop:1 #c0392b);
    border: 2px solid #a93226;
}

QPushButton[class="danger"]:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #ec7063, stop:1 #e74c3c);
    border: 2px solid #e74c3c;
    border-bottom: 3px solid #c0392b;
}

/* 警告按钮 - 橙色系 */
QPushButton[class="warning"] {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #f39c12, stop:1 #e67e22);
    border: 2px solid #d68910;
}

QPushButton[class="warning"]:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #f7dc6f, stop:1 #f39c12);
    border: 2px solid #f39c12;
    border-bottom: 3px solid #e67e22;
}

/* ========================================
   4. 现代化输入控件
   ======================================== */

QLineEdit {
    background-color: #2d3748;
    border: 2px solid #4a5568;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    padding: 12px 16px;
    min-height: 24px;
}

QLineEdit:focus {
    border: 2px solid #4a90e2;
    background-color: #1a252f;
    border-bottom: 3px solid #4a90e2;
}

QLineEdit:hover {
    border: 2px solid #5ba0f2;
}

/* ========================================
   5. 下拉框样式
   ======================================== */

QComboBox {
    background-color: #2d3748;
    border: 2px solid #4a5568;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    padding: 8px 16px;
    min-height: 24px;
    min-width: 120px;
}

QComboBox:hover {
    border: 2px solid #4a90e2;
}

QComboBox:focus {
    border: 2px solid #4a90e2;
    background-color: #1a252f;
}

QComboBox::drop-down {
    border: none;
    width: 30px;
    background: transparent;
}

QComboBox::down-arrow {
    image: none;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #ffffff;
    margin-right: 12px;
}

QComboBox QAbstractItemView {
    background-color: #2d3748;
    border: 2px solid #4a90e2;
    border-radius: 8px;
    color: #ffffff;
    selection-background-color: #4a90e2;
    outline: none;
    padding: 4px;
}

/* ========================================
   6. 表格样式优化
   ======================================== */

QTableWidget {
    background-color: #1a252f;
    alternate-background-color: #2d3748;
    gridline-color: #4a5568;
    border: 2px solid #4a5568;
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
}

QTableWidget::item {
    padding: 12px 8px;
    border: none;
}

QTableWidget::item:selected {
    background-color: #4a90e2;
    color: #ffffff;
}

QTableWidget::item:hover {
    background-color: rgba(74, 144, 226, 0.3);
}

QHeaderView::section {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #4a90e2, stop:1 #2c5282);
    color: #ffffff;
    padding: 12px 8px;
    border: 1px solid #1e3a5f;
    font-weight: bold;
    font-size: 14px;
}

QHeaderView::section:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #5ba0f2, stop:1 #4a90e2);
}

/* ========================================
   7. 滚动条现代化设计
   ======================================== */

QScrollBar:vertical {
    background: #2d3748;
    width: 12px;
    border-radius: 6px;
    margin: 0px;
}

QScrollBar::handle:vertical {
    background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                stop:0 #4a90e2, stop:1 #2c5282);
    border-radius: 6px;
    min-height: 30px;
}

QScrollBar::handle:vertical:hover {
    background: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                stop:0 #5ba0f2, stop:1 #4a90e2);
}

QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical {
    height: 0px;
}

QScrollBar:horizontal {
    background: #2d3748;
    height: 12px;
    border-radius: 6px;
    margin: 0px;
}

QScrollBar::handle:horizontal {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #4a90e2, stop:1 #2c5282);
    border-radius: 6px;
    min-width: 30px;
}

QScrollBar::handle:horizontal:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #5ba0f2, stop:1 #4a90e2);
}

QScrollBar::add-line:horizontal,
QScrollBar::sub-line:horizontal {
    width: 0px;
}

/* ========================================
   8. 设备管理面板专用样式
   ======================================== */

/* 设备列表面板主容器 */
DeviceListPanel {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 #1a252f, stop:1 #0f1419);
    border: 2px solid #4a5568;
    border-radius: 12px;
    padding: 16px;
}

/* 面板标题样式 */
DeviceListPanel QLabel[objectName="titleLabel"] {
    color: #4a90e2;
    font-size: 20px;
    font-weight: bold;
    background: transparent;
    border: none;
    padding: 12px 0px;
    margin-bottom: 8px;
}

/* 设备计数标签 */
DeviceListPanel QLabel[objectName="deviceCountLabel"] {
    color: #5ba0f2;
    font-size: 13px;
    font-weight: 600;
    background: rgba(74, 144, 226, 0.15);
    border: 2px solid rgba(74, 144, 226, 0.4);
    border-radius: 16px;
    padding: 6px 16px;
    margin: 4px;
}

/* 设备卡片样式 */
DeviceCard {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 rgba(45, 65, 95, 0.95),
                stop:1 rgba(25, 40, 65, 0.95));
    border: 2px solid rgba(74, 144, 226, 0.4);
    border-radius: 12px;
    margin: 6px 4px;
    padding: 12px;
}

DeviceCard:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 rgba(55, 75, 105, 0.95),
                stop:1 rgba(35, 50, 75, 0.95));
    border: 3px solid rgba(74, 144, 226, 0.8);
}

DeviceCard[selected="true"] {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 rgba(74, 144, 226, 0.3),
                stop:1 rgba(44, 82, 130, 0.3));
    border: 3px solid #4a90e2;
}

/* 设备名称标签 */
DeviceCard QLabel[objectName="deviceNameLabel"] {
    color: #e2e8f0;
    font-size: 16px;
    font-weight: bold;
    background: transparent;
    border: none;
    padding: 4px 0px;
}

/* 设备信息标签 */
DeviceCard QLabel[objectName="deviceInfoLabel"] {
    color: #cbd5e0;
    font-size: 12px;
    background: transparent;
    border: none;
    padding: 2px 0px;
}

/* 状态指示器 */
QLabel[objectName="statusIndicator"] {
    border-radius: 8px;
    min-width: 16px;
    max-width: 16px;
    min-height: 16px;
    max-height: 16px;
    margin: 2px;
}

QLabel[objectName="statusIndicator"][status="online"] {
    background: qradialgradient(cx:0.5, cy:0.5, radius:0.5,
                stop:0 #2ecc71, stop:0.7 #27ae60, stop:1 #1e8449);
    border: 2px solid #27ae60;
}

QLabel[objectName="statusIndicator"][status="offline"] {
    background: qradialgradient(cx:0.5, cy:0.5, radius:0.5,
                stop:0 #e74c3c, stop:0.7 #c0392b, stop:1 #a93226);
    border: 2px solid #c0392b;
}

QLabel[objectName="statusIndicator"][status="warning"] {
    background: qradialgradient(cx:0.5, cy:0.5, radius:0.5,
                stop:0 #f39c12, stop:0.7 #e67e22, stop:1 #d68910);
    border: 2px solid #e67e22;
}

/* 设备卡片按钮 */
DeviceCard QPushButton {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 rgba(74, 144, 226, 0.4),
                stop:1 rgba(44, 82, 130, 0.4));
    color: #e2e8f0;
    border: 2px solid rgba(74, 144, 226, 0.6);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    min-height: 28px;
    min-width: 60px;
}

DeviceCard QPushButton:hover {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 rgba(74, 144, 226, 0.7),
                stop:1 rgba(44, 82, 130, 0.7));
    border: 2px solid #4a90e2;
    color: #ffffff;
    border-bottom: 3px solid rgba(44, 82, 130, 0.9);
}

DeviceCard QPushButton:pressed {
    background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                stop:0 rgba(74, 144, 226, 0.9),
                stop:1 rgba(44, 82, 130, 0.9));
    border: 2px solid rgba(74, 144, 226, 0.5);
    border-bottom: 1px solid rgba(44, 82, 130, 0.5);
}

/* ========================================
   9. 右侧功能面板样式
   ======================================== */

#rightFunctionPanel {
    background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1,
               stop:0 #0f1419, stop:1 #1a252f);
    border-left: 3px solid #4a90e2;
    border-radius: 0px;
}

#PanelTitle {
    background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,
                stop:0 #4a90e2, stop:1 #2c5282);
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    padding: 20px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: center;
    border: 2px solid #4a90e2;
}

/* ========================================
   10. 学术演示优化样式
   ======================================== */

/* 大字体模式 - 适合投影演示 */
QWidget[class="presentation"] {
    font-size: 16px;
}

QWidget[class="presentation"] QPushButton {
    font-size: 16px;
    padding: 12px 24px;
    min-height: 40px;
}

QWidget[class="presentation"] QLabel {
    font-size: 18px;
}

/* 高对比度模式 - 适合明亮环境 */
QWidget[class="high-contrast"] {
    color: #ffffff;
}

QWidget[class="high-contrast"] QPushButton {
    border-width: 3px;
}

QWidget[class="high-contrast"] QLineEdit {
    border-width: 3px;
}
