/* Modern analytics style for Summarizer */

* {
    font-family: ${font_ui_stack};
    color: ${color_text_primary};
}

QWidget {
    background-color: ${color_app_bg};
    font-size: ${font_body_px}px;
}

QMainWindow,
QDialog {
    background-color: ${color_app_bg};
}

QFrame {
    border: none;
    background-color: transparent;
}

/* Shell areas -------------------------------------------------------------- */
#headerBar {
    background: ${color_surface};
    border-bottom: 1px solid ${color_border};
    border-radius: 0;
    padding: 4px 12px;
}

#sidebarContainer {
    background: ${color_surface};
    border-right: 1px solid ${color_border};
    border-radius: 0;
    padding: 0;
}

#sideBar,
#navigationPanel {
    background: ${color_surface};
    border-right: 1px solid ${color_border};
    border-radius: 0;
}

QFrame#footerBar {
    background: ${color_surface};
    border-top: 1px solid ${color_border};
    border-radius: ${radius_surface}px;
}

/* Cards -------------------------------------------------------------------- */
QFrame[card="true"],
QWidget[card="true"] {
    background: ${color_surface};
    border: 1px solid ${color_border};
    border-radius: ${radius_surface}px;
}

QFrame#resultsBody,
QFrame#resultsBody[card="true"] {
    background: transparent;
    border: none;
    border-radius: 0;
}

QLabel[cardTitle="true"] {
    font-size: ${font_section_title_px}px;
    font-weight: ${font_weight_semibold};
    color: ${color_text_primary};
}

/* Typography --------------------------------------------------------------- */
QLabel[role="appTitle"] {
    font-size: ${font_caption_px}px;
    font-weight: ${font_weight_semibold};
    color: ${color_text_primary};
    background: transparent;
    border: none;
}

QLabel#appLogoLabel {
    background: transparent;
    border: none;
    padding: 0;
}

QLabel[role="title"] {
    font-size: ${font_page_title_px}px;
    font-weight: ${font_weight_semibold};
    color: ${color_text_primary};
}

QLabel[role="subtitle"],
QLabel.section-title {
    font-size: ${font_section_title_px}px;
    font-weight: ${font_weight_semibold};
    color: ${color_text_primary};
}

QLabel[role="helper"] {
    font-size: ${font_secondary_px}px;
    font-weight: ${font_weight_regular};
    color: ${color_text_secondary};
}

QLabel[role="badge"] {
    border-radius: 12px;
    padding: 4px 10px;
    background-color: rgba(43, 125, 233, 0.12);
    color: ${color_secondary};
    font-size: ${font_chip_px}px;
    font-weight: ${font_weight_semibold};
}

QLabel[role="badge"][state="warning"] {
    background-color: rgba(242, 153, 74, 0.18);
    color: ${color_warning};
}

QLabel[role="badge"][state="error"] {
    background-color: rgba(235, 87, 87, 0.18);
    color: ${color_error};
}

/* Buttons ------------------------------------------------------------------ */
QPushButton {
    min-height: ${button_height}px;
    padding: 8px 16px;
    border-radius: ${radius_button}px;
    border: 1px solid transparent;
    font-size: ${font_button_px}px;
    font-weight: ${font_weight_semibold};
    background-color: ${color_primary};
    color: #FFFFFF;
}

QPushButton:hover {
    background-color: ${color_primary_hover};
    color: #FFFFFF;
}

QPushButton:pressed {
    background-color: ${color_primary_hover};
    border-color: ${color_primary_hover};
    color: #FFFFFF;
}

QPushButton:checked,
QPushButton:default,
QPushButton:focus {
    background-color: ${color_primary};
    border-color: ${color_primary};
    color: #FFFFFF;
    outline: none;
}

QPushButton:checked:hover,
QPushButton:default:hover,
QPushButton:focus:hover {
    background-color: ${color_primary_hover};
    border-color: ${color_primary_hover};
    color: #FFFFFF;
}

QPushButton[variant="secondary"] {
    background-color: ${color_surface};
    border: 1px solid ${color_border};
    color: ${color_text_primary};
}

QPushButton[variant="secondary"]:hover {
    border-color: ${color_secondary};
    background-color: ${color_brand_soft};
}

QPushButton[variant="secondary"]:checked,
QPushButton[variant="secondary"]:default,
QPushButton[variant="secondary"]:focus {
    border-color: ${color_secondary};
    background-color: ${color_table_selection};
    color: ${color_text_primary};
    outline: none;
}

QPushButton[variant="ghost"] {
    background-color: transparent;
    border: none;
    color: ${color_secondary};
    font-weight: 600;
}

QPushButton[variant="ghost"]:checked,
QPushButton[variant="ghost"]:default,
QPushButton[variant="ghost"]:focus {
    background-color: #EAF4FF;
    border: none;
    color: ${color_secondary};
    outline: none;
}

/* Inputs ------------------------------------------------------------------- */
QLineEdit,
QComboBox,
QPlainTextEdit,
QTextEdit,
QSpinBox,
QDoubleSpinBox {
    background-color: ${color_surface};
    border: 1px solid ${color_border};
    border-radius: ${radius_input}px;
    color: ${color_text_primary};
    padding: 6px 10px;
    min-height: ${input_height}px;
    selection-background-color: ${color_table_selection};
    selection-color: ${color_text_primary};
}

QLineEdit:focus,
QComboBox:focus,
QPlainTextEdit:focus,
QTextEdit:focus,
QSpinBox:focus,
QDoubleSpinBox:focus {
    border: 1px solid ${color_secondary};
    outline: none;
}

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

/* Tabs --------------------------------------------------------------------- */
QTabWidget::pane {
    border: none;
    padding-top: 4px;
}

QTabBar::tab {
    min-width: 120px;
    min-height: ${tab_height}px;
    margin-right: 4px;
    padding: 8px 14px;
    font-size: ${font_secondary_px}px;
    color: ${color_text_secondary};
    font-weight: ${font_weight_medium};
    background: transparent;
    border-bottom: 3px solid transparent;
}

QTabBar::tab:selected {
    color: ${color_text_primary};
    font-weight: ${font_weight_semibold};
    border-bottom: 3px solid ${color_primary};
    background: rgba(242, 200, 17, 0.08);
    border-top-left-radius: ${radius_surface}px;
    border-top-right-radius: ${radius_surface}px;
}

QTabBar::tab:hover {
    color: ${color_text_primary};
}

/* Sidebar navigation ------------------------------------------------------- */
QPushButton[navIcon="true"],
QToolButton[navIcon="true"] {
    background: transparent;
    border: none;
    padding: 4px;
    margin: 2px 0;
    min-width: 50px;
    max-width: 50px;
    min-height: 36px;
    border-radius: 0;
}

QPushButton[navIcon="true"]:hover,
QToolButton[navIcon="true"]:hover {
    background: #F3F4F6;
}

QPushButton[navIcon="true"][active="true"],
QToolButton[navIcon="true"][active="true"],
QPushButton[navIcon="true"]:checked,
QToolButton[navIcon="true"]:checked {
    background: #F3F4F6;
    border: none;
    padding-left: 4px;
}

#sidebarActiveIndicator {
    background: ${color_brand};
    border-radius: 1px;
}

QFrame#sidebarContainer[themeMode="dark"] QPushButton[navIcon="true"],
QFrame#sidebarContainer[themeMode="dark"] QToolButton[navIcon="true"] {
    background: transparent;
    border: none;
}

QFrame#sidebarContainer[themeMode="dark"] QPushButton[navIcon="true"]:hover,
QFrame#sidebarContainer[themeMode="dark"] QToolButton[navIcon="true"]:hover {
    background: #243044;
    border: none;
}

QFrame#sidebarContainer[themeMode="dark"] QPushButton[navIcon="true"][active="true"],
QFrame#sidebarContainer[themeMode="dark"] QToolButton[navIcon="true"][active="true"],
QFrame#sidebarContainer[themeMode="dark"] QPushButton[navIcon="true"]:checked,
QFrame#sidebarContainer[themeMode="dark"] QToolButton[navIcon="true"]:checked {
    background: #243044;
    border: none;
}

/* Tables and lists --------------------------------------------------------- */
QTableView {
    border: 1px solid ${color_border};
    border-radius: ${radius_table}px;
    background-color: ${color_surface};
    gridline-color: ${color_border};
    selection-background-color: ${color_table_selection};
    selection-color: ${color_text_primary};
    alternate-background-color: ${color_table_zebra};
}

QTableView::item {
    padding: 6px 10px;
}

QTableView::item:selected {
    border: none;
}

QHeaderView::section {
    background-color: ${color_surface};
    color: ${color_text_primary};
    border: none;
    border-bottom: 1px solid ${color_border};
    padding: 10px 12px;
    font-weight: 600;
}

QTableCornerButton::section {
    background-color: ${color_surface};
    border: none;
    border-bottom: 1px solid ${color_border};
}

QListView,
QTreeView {
    background-color: ${color_surface};
    border: 1px solid ${color_border};
    border-radius: ${radius_surface}px;
    alternate-background-color: ${color_table_zebra};
}

QListWidget::item,
QTreeWidget::item {
    padding: 6px 10px;
}

QListWidget::item:selected,
QTreeWidget::item:selected {
    background-color: ${color_table_selection};
    border: 1px solid ${color_primary};
}

/* Splitter and scrollbars -------------------------------------------------- */
QSplitter::handle {
    background-color: ${color_splitter};
    width: 4px;
    margin: 8px 0;
}

QScrollBar:vertical {
    background: transparent;
    width: 12px;
    margin: 4px;
}

QScrollBar::handle:vertical {
    background: rgba(17, 24, 39, 0.18);
    border-radius: 6px;
    min-height: 30px;
}

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

/* Progress ----------------------------------------------------------------- */
QProgressBar {
    border: none;
    background-color: rgba(43, 125, 233, 0.14);
    border-radius: 7px;
    min-height: 14px;
}

QProgressBar::chunk {
    background-color: ${color_secondary};
    border-radius: 7px;
}

/* Tooltip ------------------------------------------------------------------ */
QToolTip {
    background-color: #111827;
    color: #ffffff;
    border: 1px solid #111827;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: ${font_caption_px}px;
}

/* Message boxes ------------------------------------------------------------ */
QMessageBox {
    background-color: ${color_surface};
}

QMessageBox QLabel {
    font-size: ${font_body_px}px;
    color: ${color_text_primary};
}

QMessageBox QPushButton,
QDialogButtonBox QPushButton {
    min-height: ${button_height}px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid ${color_border};
    font-size: ${font_button_px}px;
    font-weight: ${font_weight_regular};
    background-color: ${color_surface};
    color: ${color_text_primary};
}

QMessageBox QPushButton:default,
QDialogButtonBox QPushButton:default {
    background-color: #252B33;
    border: 1px solid #252B33;
    color: #FFFFFF;
    font-weight: 500;
}

QMessageBox QPushButton:hover,
QDialogButtonBox QPushButton:hover {
    background-color: #F9FAFB;
    border-color: #9CA3AF;
}

QMessageBox QPushButton:default:hover,
QDialogButtonBox QPushButton:default:hover {
    background-color: #2E3640;
    border-color: #2E3640;
}

QMessageBox QPushButton:pressed,
QDialogButtonBox QPushButton:pressed {
    background-color: #F3F4F6;
    border-color: #6B7280;
}

QDialog[themeMode="dark"],
QMessageBox[themeMode="dark"] {
    background-color: ${color_app_bg};
    color: ${color_text_primary};
}

QDialog[themeMode="dark"] QWidget,
QDialog[themeMode="dark"] QFrame,
QDialog[themeMode="dark"] QScrollArea,
QDialog[themeMode="dark"] QAbstractScrollArea,
QDialog[themeMode="dark"] QAbstractScrollArea::viewport {
    background-color: ${color_app_bg};
    color: ${color_text_primary};
}

QDialog[themeMode="dark"] QLabel,
QDialog[themeMode="dark"] QCheckBox,
QDialog[themeMode="dark"] QRadioButton,
QMessageBox[themeMode="dark"] QLabel {
    color: ${color_text_primary};
    background: transparent;
}

QDialog[themeMode="dark"] QLineEdit,
QDialog[themeMode="dark"] QComboBox,
QDialog[themeMode="dark"] QTextEdit,
QDialog[themeMode="dark"] QPlainTextEdit,
QDialog[themeMode="dark"] QSpinBox,
QDialog[themeMode="dark"] QDoubleSpinBox,
QDialog[themeMode="dark"] QListWidget,
QDialog[themeMode="dark"] QListView,
QDialog[themeMode="dark"] QTreeView,
QDialog[themeMode="dark"] QTableWidget,
QDialog[themeMode="dark"] QTableView {
    background-color: ${color_surface};
    color: ${color_text_primary};
    border-color: ${color_border};
    selection-background-color: ${color_table_selection};
    selection-color: ${color_text_primary};
    alternate-background-color: ${color_table_zebra};
}

QDialog[themeMode="dark"] QHeaderView::section,
QDialog[themeMode="dark"] QTableCornerButton::section {
    background-color: ${color_surface};
    color: ${color_text_primary};
    border-color: ${color_border};
}

QDialog[themeMode="dark"] QPushButton,
QDialog[themeMode="dark"] QDialogButtonBox QPushButton,
QMessageBox[themeMode="dark"] QPushButton {
    background-color: ${color_surface};
    border-color: ${color_border};
    color: ${color_text_primary};
}

QDialog[themeMode="dark"] QPushButton:hover,
QDialog[themeMode="dark"] QDialogButtonBox QPushButton:hover,
QMessageBox[themeMode="dark"] QPushButton:hover {
    background-color: #273449;
    border-color: #475569;
    color: ${color_text_primary};
}

QDialog[themeMode="dark"] QPushButton:default,
QDialog[themeMode="dark"] QDialogButtonBox QPushButton:default,
QMessageBox[themeMode="dark"] QPushButton:default {
    background-color: #F8FAFC;
    border-color: #F8FAFC;
    color: #0B1020;
}

QDialog[themeMode="dark"] QPushButton:default:hover,
QDialog[themeMode="dark"] QDialogButtonBox QPushButton:default:hover,
QMessageBox[themeMode="dark"] QPushButton:default:hover {
    background-color: #E2E8F0;
    border-color: #E2E8F0;
    color: #0B1020;
}

QDialog[themeMode="dark"] QComboBox QAbstractItemView {
    background-color: ${color_surface};
    color: ${color_text_primary};
    border-color: ${color_border};
    selection-background-color: ${color_table_selection};
}

/* Ribbon ------------------------------------------------------------------- */
#ribbonBar {
    background-color: ${color_surface};
    border: 1px solid ${color_border};
    border-radius: 0;
}

[ribbonGroup="true"] {
    background: transparent;
}

QLabel[ribbonGroupTitle="true"] {
    font-size: ${font_caption_px}px;
    font-weight: ${font_weight_semibold};
    color: ${color_text_secondary};
    margin-left: 2px;
}

QToolButton[ribbonButton="true"] {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: ${font_caption_px}px;
    color: ${color_text_primary};
    qproperty-wordWrap: true;
    qproperty-iconSize: 20px 20px;
}

QToolButton[ribbonButton="true"]:hover {
    background: #E6F0FF;
    border-color: #D4E4FF;
}

QToolButton[ribbonButton="true"]:pressed {
    background: #D9E7FF;
    border-color: #B5CCF3;
}

QFrame#ribbonSeparator {
    background: ${color_border};
}

/* Status bar --------------------------------------------------------------- */
QStatusBar {
    background-color: ${color_surface};
    border-top: 1px solid ${color_border};
}

/* Header actions ----------------------------------------------------------- */
#headerBar QToolButton {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: ${color_text_primary};
    font-size: ${font_secondary_px}px;
    padding: 3px 7px;
    min-height: 22px;
}

#headerBar QToolButton:hover {
    background: ${color_brand_soft};
    border-color: ${color_border};
}

/* Dark mode overlay -------------------------------------------------------- */
QWidget[themeMode="dark"],
QFrame[themeMode="dark"],
QStackedWidget[themeMode="dark"],
QScrollArea[themeMode="dark"],
QAbstractScrollArea[themeMode="dark"],
QAbstractScrollArea[themeMode="dark"]::viewport {
    background-color: ${color_app_bg};
    color: ${color_text_primary};
}

QFrame[themeMode="dark"][card="true"],
QWidget[themeMode="dark"][card="true"],
QFrame#headerBar[themeMode="dark"],
QFrame#sidebarContainer[themeMode="dark"],
QFrame#resultsBody[themeMode="dark"],
QFrame#ribbonBar[themeMode="dark"],
QFrame#ModelVisualSidePanel[themeMode="dark"],
QFrame#ModelBuilderDataPanel[themeMode="dark"],
QFrame#VisualFormatPanel[themeMode="dark"] {
    background-color: ${color_surface};
    border-color: ${color_border};
    color: ${color_text_primary};
}

QLabel[themeMode="dark"],
QCheckBox[themeMode="dark"],
QRadioButton[themeMode="dark"],
QToolButton[themeMode="dark"],
QPushButton[themeMode="dark"],
QComboBox[themeMode="dark"],
QLineEdit[themeMode="dark"],
QTextEdit[themeMode="dark"],
QPlainTextEdit[themeMode="dark"],
QListWidget[themeMode="dark"],
QListView[themeMode="dark"],
QTreeView[themeMode="dark"],
QTableView[themeMode="dark"] {
    color: ${color_text_primary};
}

QLineEdit[themeMode="dark"],
QComboBox[themeMode="dark"],
QTextEdit[themeMode="dark"],
QPlainTextEdit[themeMode="dark"],
QSpinBox[themeMode="dark"],
QDoubleSpinBox[themeMode="dark"],
QListWidget[themeMode="dark"],
QListView[themeMode="dark"],
QTreeView[themeMode="dark"],
QTableView[themeMode="dark"] {
    background-color: ${color_surface};
    border-color: ${color_border};
    selection-background-color: ${color_table_selection};
    selection-color: ${color_text_primary};
}

QHeaderView::section[themeMode="dark"],
QHeaderView[themeMode="dark"]::section,
QTableCornerButton::section[themeMode="dark"] {
    background-color: ${color_surface};
    color: ${color_text_primary};
    border-color: ${color_border};
}

QWidget[themeMode="dark"] QLabel,
QWidget[themeMode="dark"] QCheckBox,
QWidget[themeMode="dark"] QRadioButton,
QWidget[themeMode="dark"] QToolButton,
QWidget[themeMode="dark"] QPushButton,
QWidget[themeMode="dark"] QComboBox,
QWidget[themeMode="dark"] QLineEdit,
QWidget[themeMode="dark"] QTextEdit,
QWidget[themeMode="dark"] QPlainTextEdit,
QWidget[themeMode="dark"] QListWidget,
QWidget[themeMode="dark"] QListView,
QWidget[themeMode="dark"] QTreeView,
QWidget[themeMode="dark"] QTableView {
    color: ${color_text_primary};
}

QWidget[themeMode="dark"] QLineEdit,
QWidget[themeMode="dark"] QComboBox,
QWidget[themeMode="dark"] QTextEdit,
QWidget[themeMode="dark"] QPlainTextEdit,
QWidget[themeMode="dark"] QSpinBox,
QWidget[themeMode="dark"] QDoubleSpinBox,
QWidget[themeMode="dark"] QListWidget,
QWidget[themeMode="dark"] QListView,
QWidget[themeMode="dark"] QTreeView,
QWidget[themeMode="dark"] QTableView {
    background-color: ${color_surface};
    border-color: ${color_border};
    selection-background-color: ${color_table_selection};
    selection-color: ${color_text_primary};
}

QWidget[themeMode="dark"] QHeaderView::section,
QWidget[themeMode="dark"] QTableCornerButton::section,
QComboBox[themeMode="dark"] QAbstractItemView {
    background-color: ${color_surface};
    color: ${color_text_primary};
    border-color: ${color_border};
    selection-background-color: ${color_table_selection};
    selection-color: ${color_text_primary};
}

QFrame#ModelVisualSidePanel[themeMode="dark"] QWidget,
QFrame#ModelVisualSidePanel[themeMode="dark"] QFrame,
QFrame#ModelVisualSidePanel[themeMode="dark"] QScrollArea,
QFrame#ModelVisualSidePanel[themeMode="dark"] QAbstractScrollArea,
QFrame#ModelVisualSidePanel[themeMode="dark"] QAbstractScrollArea::viewport,
QFrame#ModelBuilderDataPanel[themeMode="dark"] QWidget,
QFrame#ModelBuilderDataPanel[themeMode="dark"] QFrame,
QFrame#ModelBuilderDataPanel[themeMode="dark"] QListWidget,
QFrame#ModelBuilderDataPanel[themeMode="dark"] QAbstractScrollArea,
QFrame#ModelBuilderDataPanel[themeMode="dark"] QAbstractScrollArea::viewport {
    background-color: ${color_surface};
    color: ${color_text_primary};
}

QToolTip[themeMode="dark"] {
    background-color: #0B1120;
    color: ${color_text_primary};
    border-color: ${color_border};
}
