/* Modern Dark Theme for AnkiGammon GUI - Inspired by Catppuccin Mocha */

/* Main Window and Dialogs */
QMainWindow, QDialog, QWidget {
    background-color: #1e1e2e;
    color: #cdd6f4;
}

/* Primary Buttons */
QPushButton {
    background-color: #89b4fa;
    color: #1e1e2e;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    min-height: 28px;
}

QPushButton:hover {
    background-color: #a0c8fc;
}

QPushButton:pressed {
    background-color: #74c7ec;
}

QPushButton:disabled {
    background-color: #313244;
    color: #6c7086;
}

/* Settings and Secondary Buttons */
QPushButton#btn_settings {
    background-color: transparent;
    color: #cdd6f4;
    border: 2px solid #45475a;
}

QPushButton#btn_settings:hover {
    background-color: rgba(137, 180, 250, 0.12);
    color: #f5e0dc;
    border-color: #89b4fa;
}

QPushButton#btn_settings:pressed {
    background-color: rgba(137, 180, 250, 0.18);
    color: #f5e0dc;
    border-color: #89b4fa;
}

/* Position List Widget */
QListWidget {
    background-color: #181825;
    border: 2px solid #313244;
    border-radius: 8px;
    padding: 6px;
    outline: none;
}

QListWidget::item {
    padding: 12px 10px;
    border-radius: 6px;
    margin: 2px 0px;
    color: #cdd6f4;
}

QListWidget::item:selected {
    background-color: #89b4fa;
    color: #1e1e2e;
    font-weight: 600;
}

QListWidget::item:hover {
    background-color: #313244;
}

QListWidget::item:selected:hover {
    background-color: #a0c8fc;
}

/* Group Boxes */
QGroupBox {
    border: 2px solid #45475a;
    border-radius: 8px;
    margin-top: 16px;
    font-weight: 700;
    padding-top: 16px;
    color: #f5e0dc;
    font-size: 13px;
}

QGroupBox::title {
    subcontrol-origin: margin;
    subcontrol-position: top left;
    padding: 4px 12px;
    background-color: #1e1e2e;
    border-radius: 4px;
}

/* Labels */
QLabel {
    color: #cdd6f4;
    font-size: 13px;
}

QLabel#title {
    color: #f5e0dc;
    font-size: 16px;
}

/* Input Fields */
QLineEdit, QComboBox {
    padding: 8px 12px;
    border: 2px solid #45475a;
    border-radius: 6px;
    background-color: #181825;
    color: #cdd6f4;
    selection-background-color: #89b4fa;
    selection-color: #1e1e2e;
    font-size: 13px;
}

QLineEdit:focus, QComboBox:focus {
    border: 2px solid #89b4fa;
    background-color: #1e1e2e;
}

QComboBox:hover {
    border-color: #6c7086;
}

QComboBox:disabled {
    background-color: #313244;
    color: #6c7086;
    border-color: #313244;
}

QComboBox::drop-down {
    border: none;
    padding-right: 8px;
}

QComboBox::down-arrow {
    image: url(ankigammon/gui/resources/down-arrow.svg);
    width: 12px;
    height: 8px;
}

QComboBox:disabled::down-arrow {
    opacity: 0.3;
}

QComboBox QAbstractItemView {
    background-color: #181825;
    border: 2px solid #45475a;
    selection-background-color: #89b4fa;
    selection-color: #1e1e2e;
    color: #cdd6f4;
    padding: 4px;
}

/* Checkboxes */
QCheckBox {
    spacing: 10px;
    color: #cdd6f4;
}

QCheckBox::indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 3px solid #45475a;
    background-color: #181825;
}

QCheckBox::indicator:hover {
    border-color: #89b4fa;
}

QCheckBox::indicator:checked {
    background-color: #89b4fa;
    border: 3px solid #45475a;
}

QCheckBox::indicator:checked:hover {
    background-color: #a0c8fc;
    border-color: #89b4fa;
}

/* Radio Buttons */
QRadioButton {
    spacing: 10px;
    color: #cdd6f4;
}

QRadioButton::indicator {
    width: 20px;
    height: 20px;
    border-radius: 10px;
    border: 2px solid #45475a;
    background-color: #181825;
}

QRadioButton::indicator:hover {
    border-color: #89b4fa;
}

QRadioButton::indicator:checked {
    background-color: #ffffff;
    border: 5px solid #89b4fa;
}

/* Progress Bar */
QProgressBar {
    border: 2px solid #45475a;
    border-radius: 6px;
    text-align: center;
    background-color: #181825;
    color: #ffffff;
    font-weight: 700;
    height: 24px;
}

QProgressBar::chunk {
    background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0,
                                      stop:0 #89b4fa, stop:1 #74c7ec);
    border-radius: 4px;
    margin: 2px;
}

/* Text Edit */
QTextEdit {
    background-color: #181825;
    border: 2px solid #45475a;
    border-radius: 6px;
    padding: 10px;
    color: #cdd6f4;
    selection-background-color: #89b4fa;
    selection-color: #1e1e2e;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

/* Status Bar */
QStatusBar {
    background-color: #181825;
    color: #a6adc8;
    border-top: 1px solid #313244;
}

QStatusBar::item {
    border: none;
}

/* Menu Bar */
QMenuBar {
    background-color: #181825;
    color: #cdd6f4;
    border-bottom: 2px solid #313244;
    padding: 4px;
}

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

QMenuBar::item:selected {
    background-color: #313244;
    color: #f5e0dc;
}

QMenuBar::item:pressed {
    background-color: #45475a;
}

/* Menus */
QMenu {
    background-color: #181825;
    border: 2px solid #313244;
    border-radius: 8px;
    padding: 6px;
}

QMenu::item {
    padding: 8px 32px 8px 16px;
    border-radius: 4px;
    color: #cdd6f4;
}

QMenu::item:selected {
    background-color: #89b4fa;
    color: #1e1e2e;
}

QMenu::separator {
    height: 2px;
    background-color: #313244;
    margin: 6px 10px;
}

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

/* Dialog Button Box */
QDialogButtonBox QPushButton {
    min-width: 90px;
    padding: 8px 16px;
}

/* Scrollbars */
QScrollBar:vertical {
    border: none;
    background-color: #181825;
    width: 12px;
    border-radius: 6px;
}

QScrollBar::handle:vertical {
    background-color: #45475a;
    border-radius: 6px;
    min-height: 30px;
}

QScrollBar::handle:vertical:hover {
    background-color: #585b70;
}

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

QScrollBar:horizontal {
    border: none;
    background-color: #181825;
    height: 12px;
    border-radius: 6px;
}

QScrollBar::handle:horizontal {
    background-color: #45475a;
    border-radius: 6px;
    min-width: 30px;
}

QScrollBar::handle:horizontal:hover {
    background-color: #585b70;
}

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

/* Tooltips */
QToolTip {
    background-color: #313244;
    color: #cdd6f4;
    border: 2px solid #45475a;
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
}

/* Message Boxes */
QMessageBox {
    background-color: #1e1e2e;
}

QMessageBox QLabel {
    color: #cdd6f4;
}

/* Tab Widgets (for future use) */
QTabWidget::pane {
    border: 2px solid #313244;
    border-radius: 8px;
    background-color: #181825;
}

QTabBar::tab {
    background-color: #313244;
    color: #a6adc8;
    padding: 10px 20px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    margin-right: 2px;
}

QTabBar::tab:selected {
    background-color: #89b4fa;
    color: #1e1e2e;
    font-weight: 600;
}

QTabBar::tab:hover {
    background-color: #45475a;
    color: #cdd6f4;
}
