/* ===================================================================
   Fluent Design Dark Mode Stylesheet for Qt6
   Windows 11 inspired dark theme
   =================================================================== */

/* === Color Palette ===
   Background:     #202020
   Surface:        #2B2B2B
   Surface Hover:  #3A3A3A
   Border:         #3F3F3F
   Text:           #FFFFFF
   Text Secondary: #B0B0B0
   Accent:         #0078D4
   Accent Hover:   #106EBE
   === */

/* === Global Styles === */
* {
    font-family: "Segoe UI", "Noto Sans", Roboto, sans-serif;
    font-size: 9pt;
}

QWidget {
    background-color: #202020;
    color: #FFFFFF;
    selection-background-color: #0078D4;
    selection-color: #FFFFFF;
}

/* === QMainWindow === */
QMainWindow {
    background-color: #202020;
}

QMainWindow::separator {
    background-color: #3F3F3F;
    width: 1px;
    height: 1px;
}

QMainWindow::separator:hover {
    background-color: #0078D4;
}

/* === QPushButton === */
QPushButton {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    padding: 6px 16px;
    min-height: 20px;
    font-weight: 500;
}

QPushButton:hover {
    background-color: #3A3A3A;
    border-color: #5A5A5A;
}

QPushButton:pressed {
    background-color: #1F1F1F;
    border-color: #3F3F3F;
}

QPushButton:disabled {
    background-color: #2B2B2B;
    color: #5A5A5A;
    border-color: #3F3F3F;
}

QPushButton:default {
    background-color: #0078D4;
    border-color: #0078D4;
    color: #FFFFFF;
}

QPushButton:default:hover {
    background-color: #106EBE;
    border-color: #106EBE;
}

QPushButton:default:pressed {
    background-color: #005A9E;
    border-color: #005A9E;
}

/* === QLineEdit === */
QLineEdit {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    padding: 6px 8px;
    selection-background-color: #0078D4;
}

QLineEdit:hover {
    border-color: #5A5A5A;
}

QLineEdit:focus {
    background-color: #1F1F1F;
    border: 2px solid #0078D4;
    padding: 5px 7px;
}

QLineEdit:disabled {
    background-color: #2B2B2B;
    color: #5A5A5A;
    border-color: #3F3F3F;
}

QLineEdit[readOnly="true"] {
    background-color: #2B2B2B;
    color: #B0B0B0;
}

/* === QTextEdit & QPlainTextEdit === */
QTextEdit, QPlainTextEdit {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    padding: 8px;
    selection-background-color: #0078D4;
}

QTextEdit:hover, QPlainTextEdit:hover {
    border-color: #5A5A5A;
}

QTextEdit:focus, QPlainTextEdit:focus {
    border: 2px solid #0078D4;
    padding: 7px;
}

QTextEdit:disabled, QPlainTextEdit:disabled {
    background-color: #2B2B2B;
    color: #5A5A5A;
}

/* === QComboBox === */
QComboBox {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    padding: 6px 8px;
    min-height: 20px;
}

QComboBox:hover {
    background-color: #3A3A3A;
    border-color: #5A5A5A;
}

QComboBox:focus {
    border: 2px solid #0078D4;
}

QComboBox:disabled {
    background-color: #2B2B2B;
    color: #5A5A5A;
}

QComboBox::drop-down {
    border: none;
    width: 20px;
}

QComboBox::down-arrow {
    image: url(:/icons/down-arrow.png);
    width: 12px;
    height: 12px;
}

QComboBox QAbstractItemView {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    selection-background-color: #0078D4;
    selection-color: #FFFFFF;
    outline: none;
}

QComboBox QAbstractItemView::item {
    min-height: 28px;
    padding-left: 8px;
}

QComboBox QAbstractItemView::item:hover {
    background-color: #3A3A3A;
}

/* === QSpinBox & QDoubleSpinBox === */
QSpinBox, QDoubleSpinBox {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    padding: 6px 8px;
    min-height: 20px;
}

QSpinBox:hover, QDoubleSpinBox:hover {
    border-color: #5A5A5A;
}

QSpinBox:focus, QDoubleSpinBox:focus {
    border: 2px solid #0078D4;
}

QSpinBox:disabled, QDoubleSpinBox:disabled {
    background-color: #2B2B2B;
    color: #5A5A5A;
}

QSpinBox::up-button, QDoubleSpinBox::up-button {
    background-color: transparent;
    border: none;
    width: 16px;
}

QSpinBox::up-button:hover, QDoubleSpinBox::up-button:hover {
    background-color: #3A3A3A;
}

QSpinBox::down-button, QDoubleSpinBox::down-button {
    background-color: transparent;
    border: none;
    width: 16px;
}

QSpinBox::down-button:hover, QDoubleSpinBox::down-button:hover {
    background-color: #3A3A3A;
}

/* === QCheckBox === */
QCheckBox {
    spacing: 8px;
    color: #FFFFFF;
}

QCheckBox::indicator {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #5A5A5A;
    background-color: #2B2B2B;
}

QCheckBox::indicator:hover {
    background-color: #3A3A3A;
    border-color: #6A6A6A;
}

QCheckBox::indicator:checked {
    background-color: #0078D4;
    border-color: #0078D4;
    image: url(:/icons/checkmark.png);
}

QCheckBox::indicator:checked:hover {
    background-color: #106EBE;
    border-color: #106EBE;
}

QCheckBox::indicator:disabled {
    background-color: #2B2B2B;
    border-color: #3F3F3F;
}

QCheckBox:disabled {
    color: #5A5A5A;
}

/* === QRadioButton === */
QRadioButton {
    spacing: 8px;
    color: #FFFFFF;
}

QRadioButton::indicator {
    width: 18px;
    height: 18px;
    border-radius: 9px;
    border: 1px solid #5A5A5A;
    background-color: #2B2B2B;
}

QRadioButton::indicator:hover {
    background-color: #3A3A3A;
    border-color: #6A6A6A;
}

QRadioButton::indicator:checked {
    background-color: #0078D4;
    border-color: #0078D4;
}

QRadioButton::indicator:checked:hover {
    background-color: #106EBE;
    border-color: #106EBE;
}

QRadioButton::indicator:checked::after {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background-color: #FFFFFF;
}

QRadioButton::indicator:disabled {
    background-color: #2B2B2B;
    border-color: #3F3F3F;
}

QRadioButton:disabled {
    color: #5A5A5A;
}

/* === QSlider === */
QSlider::groove:horizontal {
    height: 4px;
    background-color: #3F3F3F;
    border-radius: 2px;
}

QSlider::handle:horizontal {
    background-color: #FFFFFF;
    border: 2px solid #0078D4;
    width: 16px;
    height: 16px;
    margin: -7px 0;
    border-radius: 8px;
}

QSlider::handle:horizontal:hover {
    background-color: #FFFFFF;
    border: 2px solid #106EBE;
}

QSlider::handle:horizontal:pressed {
    background-color: #E0E0E0;
}

QSlider::sub-page:horizontal {
    background-color: #0078D4;
    border-radius: 2px;
}

QSlider::groove:vertical {
    width: 4px;
    background-color: #3F3F3F;
    border-radius: 2px;
}

QSlider::handle:vertical {
    background-color: #FFFFFF;
    border: 2px solid #0078D4;
    width: 16px;
    height: 16px;
    margin: 0 -7px;
    border-radius: 8px;
}

QSlider::sub-page:vertical {
    background-color: #0078D4;
    border-radius: 2px;
}

/* === QProgressBar === */
QProgressBar {
    background-color: #3F3F3F;
    border: none;
    border-radius: 2px;
    height: 4px;
    text-align: center;
    color: transparent;
}

QProgressBar::chunk {
    background-color: #0078D4;
    border-radius: 2px;
}

QProgressBar:disabled {
    background-color: #3F3F3F;
}

/* === QScrollBar === */
QScrollBar:horizontal {
    background-color: transparent;
    height: 12px;
    margin: 0;
}

QScrollBar::handle:horizontal {
    background-color: #5A5A5A;
    min-width: 40px;
    border-radius: 6px;
    margin: 2px;
}

QScrollBar::handle:horizontal:hover {
    background-color: #6A6A6A;
}

QScrollBar::handle:horizontal:pressed {
    background-color: #7A7A7A;
}

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

QScrollBar::add-page:horizontal,
QScrollBar::sub-page:horizontal {
    background: none;
}

QScrollBar:vertical {
    background-color: transparent;
    width: 12px;
    margin: 0;
}

QScrollBar::handle:vertical {
    background-color: #5A5A5A;
    min-height: 40px;
    border-radius: 6px;
    margin: 2px;
}

QScrollBar::handle:vertical:hover {
    background-color: #6A6A6A;
}

QScrollBar::handle:vertical:pressed {
    background-color: #7A7A7A;
}

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

QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical {
    background: none;
}

/* === QTabWidget === */
QTabWidget::pane {
    background-color: #2B2B2B;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    top: -1px;
}

QTabBar::tab {
    background-color: transparent;
    color: #B0B0B0;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 16px;
    margin-right: 4px;
}

QTabBar::tab:hover {
    color: #FFFFFF;
    background-color: #3A3A3A;
    border-bottom: 2px solid #5A5A5A;
}

QTabBar::tab:selected {
    color: #FFFFFF;
    background-color: #2B2B2B;
    border-bottom: 2px solid #0078D4;
}

QTabBar::tab:disabled {
    color: #5A5A5A;
}

/* === QGroupBox === */
QGroupBox {
    background-color: #2B2B2B;
    border: 1px solid #3F3F3F;
    border-radius: 6px;
    margin-top: 12px;
    padding-top: 12px;
    font-weight: 600;
}

QGroupBox::title {
    subcontrol-origin: margin;
    subcontrol-position: top left;
    padding: 0 8px;
    color: #FFFFFF;
    background-color: #2B2B2B;
}

/* === QLabel === */
QLabel {
    background-color: transparent;
    color: #FFFFFF;
}

QLabel:disabled {
    color: #5A5A5A;
}

/* === QToolButton === */
QToolButton {
    background-color: transparent;
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    padding: 6px;
}

QToolButton:hover {
    background-color: #3A3A3A;
}

QToolButton:pressed {
    background-color: #1F1F1F;
}

QToolButton:checked {
    background-color: #0078D4;
}

QToolButton:disabled {
    color: #5A5A5A;
}

/* === QMenu === */
QMenu {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    padding: 4px;
}

QMenu::item {
    background-color: transparent;
    padding: 6px 24px 6px 8px;
    border-radius: 4px;
}

QMenu::item:selected {
    background-color: #3A3A3A;
}

QMenu::item:disabled {
    color: #5A5A5A;
}

QMenu::separator {
    height: 1px;
    background-color: #3F3F3F;
    margin: 4px 0;
}

QMenu::icon {
    padding-left: 8px;
}

/* === QMenuBar === */
QMenuBar {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border-bottom: 1px solid #3F3F3F;
}

QMenuBar::item {
    background-color: transparent;
    padding: 6px 12px;
    border-radius: 4px;
}

QMenuBar::item:selected {
    background-color: #3A3A3A;
}

QMenuBar::item:pressed {
    background-color: #1F1F1F;
}

/* === QToolBar === */
QToolBar {
    background-color: #2B2B2B;
    border: none;
    border-bottom: 1px solid #3F3F3F;
    spacing: 4px;
    padding: 4px;
}

QToolBar::handle {
    background-color: #3F3F3F;
    width: 1px;
    height: 1px;
    margin: 4px;
}

QToolBar::separator {
    background-color: #3F3F3F;
    width: 1px;
    height: 1px;
    margin: 4px;
}

/* === QStatusBar === */
QStatusBar {
    background-color: #2B2B2B;
    color: #B0B0B0;
    border-top: 1px solid #3F3F3F;
}

QStatusBar::item {
    border: none;
}

/* === QDockWidget === */
QDockWidget {
    background-color: #2B2B2B;
    color: #FFFFFF;
    titlebar-close-icon: url(:/icons/close.png);
    titlebar-normal-icon: url(:/icons/float.png);
}

QDockWidget::title {
    background-color: #2B2B2B;
    border: 1px solid #3F3F3F;
    padding: 6px;
    text-align: left;
}

QDockWidget::close-button,
QDockWidget::float-button {
    background-color: transparent;
    border: none;
    padding: 4px;
}

QDockWidget::close-button:hover,
QDockWidget::float-button:hover {
    background-color: #3A3A3A;
    border-radius: 4px;
}

/* === QListView & QListWidget === */
QListView, QListWidget {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    outline: none;
}

QListView::item, QListWidget::item {
    padding: 6px;
    border-radius: 4px;
}

QListView::item:hover, QListWidget::item:hover {
    background-color: #3A3A3A;
}

QListView::item:selected, QListWidget::item:selected {
    background-color: #0078D4;
    color: #FFFFFF;
}

QListView::item:disabled, QListWidget::item:disabled {
    color: #5A5A5A;
}

/* === QTreeView & QTreeWidget === */
QTreeView, QTreeWidget {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    outline: none;
    show-decoration-selected: 1;
}

QTreeView::item, QTreeWidget::item {
    padding: 4px;
    border-radius: 4px;
}

QTreeView::item:hover, QTreeWidget::item:hover {
    background-color: #3A3A3A;
}

QTreeView::item:selected, QTreeWidget::item:selected {
    background-color: #0078D4;
    color: #FFFFFF;
}

QTreeView::branch, QTreeWidget::branch {
    background-color: transparent;
}

QTreeView::branch:closed:has-children, QTreeWidget::branch:closed:has-children {
    image: url(:/icons/branch-closed.png);
}

QTreeView::branch:open:has-children, QTreeWidget::branch:open:has-children {
    image: url(:/icons/branch-open.png);
}

/* === QTableView & QTableWidget === */
QTableView, QTableWidget {
    background-color: #2B2B2B;
    color: #FFFFFF;
    gridline-color: #3F3F3F;
    border: 1px solid #3F3F3F;
    border-radius: 4px;
    selection-background-color: #0078D4;
}

QTableView::item, QTableWidget::item {
    padding: 4px;
}

QTableView::item:hover, QTableWidget::item:hover {
    background-color: #3A3A3A;
}

QTableView::item:selected, QTableWidget::item:selected {
    background-color: #0078D4;
    color: #FFFFFF;
}

QHeaderView::section {
    background-color: #2B2B2B;
    color: #FFFFFF;
    padding: 6px;
    border: none;
    border-right: 1px solid #3F3F3F;
    border-bottom: 1px solid #3F3F3F;
    font-weight: 600;
}

QHeaderView::section:hover {
    background-color: #3A3A3A;
}

/* === QDialog === */
QDialog {
    background-color: #2B2B2B;
}

/* === QMessageBox === */
QMessageBox {
    background-color: #2B2B2B;
}

QMessageBox QLabel {
    color: #FFFFFF;
}

/* === QToolTip === */
QToolTip {
    background-color: #3A3A3A;
    color: #FFFFFF;
    border: 1px solid #5A5A5A;
    border-radius: 4px;
    padding: 4px 8px;
}

/* === QCalendarWidget === */
QCalendarWidget {
    background-color: #2B2B2B;
}

QCalendarWidget QToolButton {
    color: #FFFFFF;
    background-color: transparent;
    border: none;
    border-radius: 4px;
    padding: 4px;
}

QCalendarWidget QToolButton:hover {
    background-color: #3A3A3A;
}

QCalendarWidget QMenu {
    background-color: #2B2B2B;
}

QCalendarWidget QSpinBox {
    background-color: #2B2B2B;
    color: #FFFFFF;
    selection-background-color: #0078D4;
}

QCalendarWidget QAbstractItemView {
    background-color: #2B2B2B;
    color: #FFFFFF;
    selection-background-color: #0078D4;
    selection-color: #FFFFFF;
}

/* === QSplitter === */
QSplitter::handle {
    background-color: #3F3F3F;
}

QSplitter::handle:hover {
    background-color: #0078D4;
}

QSplitter::handle:horizontal {
    width: 1px;
}

QSplitter::handle:vertical {
    height: 1px;
}

/* === Custom Classes === */
.accent-button {
    background-color: #0078D4;
    color: #FFFFFF;
    border: none;
}

.accent-button:hover {
    background-color: #106EBE;
}

.accent-button:pressed {
    background-color: #005A9E;
}

.danger-button {
    background-color: #C42B1C;
    color: #FFFFFF;
    border: none;
}

.danger-button:hover {
    background-color: #A52314;
}

.card {
    background-color: #2B2B2B;
    border: 1px solid #3F3F3F;
    border-radius: 8px;
    padding: 16px;
}

.surface {
    background-color: #2B2B2B;
    border: 1px solid #3F3F3F;
}

.divider {
    background-color: #3F3F3F;
    min-height: 1px;
    max-height: 1px;
}