/* ===== mSzyfr Custom CSS v10 - clean ===== */

/* ===== Auth page - usuń tło jeziora ===== */
.mx_AuthPage,
.mx_AuthPage_modal,
.mx_MatrixChat_wrapper,
body.cpd-theme-light,
body.cpd-theme-dark {
    background-image: none !important;
    background-size: unset !important;
}
body.cpd-theme-light,
body.cpd-theme-dark,
.mx_AuthPage {
    background-color: #1c1c1c !important;
}
.mx_AuthFooter {
    display: none !important;
}

/* ===== CPD zmienne - LIGHT theme ===== */
[class*=cpd-theme-light] {
    --accent-color: #CE1D39 !important;
    --accent: #CE1D39 !important;
    --primary-color: #CE1D39 !important;
    --cpd-color-text-decorative-3: #FFFFFF !important;
    --cpd-color-bg-decorative-3: #CE1D39 !important;
    --cpd-color-text-decorative-5: #FFFFFF !important;
    --cpd-color-bg-decorative-5: #CE1D39 !important;
    --cpd-color-bg-canvas-default: #f8f8f8 !important;
    --cpd-color-text-primary: #1a1a1a !important;
    --cpd-color-text-secondary: #3a3a3a !important;
    --cpd-color-text-tertiary: #3a3a3a !important;
    --cpd-color-text-placeholder: #555 !important;
    --cpd-color-text-action-accent: #fff !important;
    --cpd-color-icon-accent-primary: #CE1D39 !important;
    --cpd-color-bg-accent-rest: #CE1D39 !important;
    --cpd-color-icon-accent-tertiary: #CE1D39 !important;
    --cpd-color-bg-accent-hovered: #a8152e !important;
    --cpd-color-blue-1100: #1a1a1a !important;
    --cpd-color-alpha-blue-300: rgba(0,0,0,0.08) !important;
    --cpd-color-border-focus-ring: transparent !important;
}

/* ===== CPD zmienne - DARK theme ===== */
[class*=cpd-theme-dark] {
    --accent-color: #CE1D39 !important;
    --accent: #CE1D39 !important;
    --primary-color: #CE1D39 !important;
    --cpd-color-text-decorative-3: #222 !important;
    --cpd-color-bg-decorative-3: #CE1D39 !important;
    --cpd-color-text-decorative-5: #222 !important;
    --cpd-color-bg-decorative-5: #CE1D39 !important;
    --cpd-color-bg-canvas-default: #222 !important;
    --cpd-color-text-primary: #f0f0f0 !important;
    --cpd-color-text-secondary: #b0b0b0 !important;
    --cpd-color-text-action-accent: #fff !important;
    --cpd-color-icon-accent-primary: #CE1D39 !important;
    --cpd-color-bg-accent-rest: #CE1D39 !important;
    --cpd-color-icon-accent-tertiary: #CE1D39 !important;
    --cpd-color-bg-accent-hovered: #a8152e !important;
    --cpd-color-blue-1100: #f2f2f2 !important;
    --cpd-color-alpha-blue-300: rgba(255,255,255,0.1) !important;
    --cpd-color-border-focus-ring: transparent !important;
}

/* ===== Tło główne ===== */
.cpd-theme-dark .mx_MatrixChat {
    background: linear-gradient(180deg, #CE1D39 -34.08%, #222 19.34%);
}
.cpd-theme-light .mx_MatrixChat {
    background: linear-gradient(180deg, #CE1D39 -34.08%, #f8f8f8 19.34%);
}
.mx_MatrixChat > :not(.mx_LeftPanel):not(.mx_SpacePanel):not(.mx_ResizeHandle):not(.mx_LeftPanel_outerWrapper) {
    background: transparent !important;
}

/* ===== Panel lewy ===== */
.cpd-theme-dark .mx_RoomListPanel {
    background: rgba(34, 34, 34, 0.60) !important;
}
.cpd-theme-dark .mx_SpacePanel.newUi {
    background: rgba(34, 34, 34, 0.80) !important;
}
.cpd-theme-light .mx_RoomListPanel {
    background: rgba(252, 252, 252, 0.60) !important;
}
.mx_LeftPanel .mx_LeftPanel_roomListContainer,
.mx_LeftPanel_newRoomList,
.mx_LeftPanel_wrapper .mx_LeftPanel_wrapper--user {
    background: none !important;
}

/* ===== Room header ===== */
.mx_RoomHeader {
    background: none !important;
    border-bottom: none;
}
[data-testid="room-list-search"] {
    border-bottom: none;
}

/* ===== Welcome page ===== */
.mx_WelcomePage_logo { display: none !important; }
.mx_Header_title {
    color: transparent !important;
    position: relative;
    display: block;
}
.mx_Header_title::after {
    content: "Witaj w mSzyfr" !important;
    color: #2e2f32;
    position: absolute;
    left: 0; right: 0; top: 0;
    visibility: visible;
}
.mx_Header_subtitle { display: none !important; }

/* ===== Home page buttons ===== */
.cpd-theme-light .mx_HomePage_default .mx_HomePage_default_buttons .mx_AccessibleButton {
    border: 1px solid #414141 !important;
    border-radius: 20px !important;
    color: #414141 !important;
}
.cpd-theme-light .mx_HomePage_default .mx_HomePage_default_buttons .mx_AccessibleButton svg {
    color: #414141;
}
.cpd-theme-dark .mx_HomePage_default .mx_HomePage_default_buttons .mx_AccessibleButton {
    border: 1px solid #FCFCFC !important;
    border-radius: 20px !important;
    color: #FCFCFC !important;
    background: none !important;
}
.cpd-theme-dark .mx_HomePage_default .mx_HomePage_default_buttons .mx_AccessibleButton svg {
    color: #FCFCFC !important;
}
.cpd-theme-dark .mx_HomePage_default h2 {
    color: #9e9b9b !important;
}

/* ===== Focus ring - usuń czerwone obwódki ===== */
.cpd-theme-light button:focus,
.cpd-theme-light button:focus-visible,
.cpd-theme-light [data-kind]:focus,
.cpd-theme-light [data-kind]:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* ===== Icon buttons w toolbarze - nie nadpisuj tła ===== */
.cpd-theme-light ._icon-button_1215g_8[data-kind="primary"],
.cpd-theme-light .mx_RoomHeader button[data-kind="primary"],
.cpd-theme-light .mx_ThreadsActivityCentre_container button[data-kind="primary"] {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ===== SETTINGS DIALOG - light theme ===== */

/* Lewy sidebar - ciemny */
.cpd-theme-light .mx_TabbedView_tabLabels {
    background: #1c1c1c !important;
    border-radius: 12px 0 0 12px !important;
}
.cpd-theme-light .mx_TabbedView_tabLabel {
    color: #c0c0c0 !important;
}
.cpd-theme-light .mx_TabbedView_tabLabel svg {
    color: inherit !important;
}
.cpd-theme-light .mx_TabbedView_tabLabel:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}
.cpd-theme-light .mx_TabbedView_tabLabel_active,
.cpd-theme-light .mx_TabbedView_tabLabel_active:hover {
    background: #CE1D39 !important;
    color: #fff !important;
    border-radius: 8px !important;
}

/* Prawa strona - białe tło */
.cpd-theme-light .mx_TabbedView_tabPanel {
    background: #fff !important;
}

/* Nagłówki sekcji */
.cpd-theme-light .mx_TabbedView_tabPanel h1,
.cpd-theme-light .mx_TabbedView_tabPanel h2,
.cpd-theme-light .mx_TabbedView_tabPanel h3,
.cpd-theme-light .mx_TabbedView_tabPanel h4,
.cpd-theme-light .mx_TabbedView_tabPanel p {
    color: #1a1a1a !important;
}

/* SettingsFlag toggle labels */
.cpd-theme-light .mx_SettingsFlag_label,
.cpd-theme-light .mx_SettingsFlag_microcopy,
.cpd-theme-light .mx_SettingsSubsection_description,
.cpd-theme-light .mx_SettingsTab_heading,
.cpd-theme-light .mx_SettingsSection_subheading,
.cpd-theme-light .mx_SettingsSubsection_heading {
    color: #1a1a1a !important;
}

/* Skróty klawiszowe - kbd na ciemnym tle */
.cpd-theme-light .mx_UserSettingsDialog .mx_KeyboardShortcut_shortcutRow * {
    color: #f0f0f0 !important;
}
.cpd-theme-light .mx_UserSettingsDialog .mx_KeyboardShortcut kbd {
    background-color: #3a3a3a !important;
    color: #f0f0f0 !important;
    border: 1px solid #555 !important;
    box-shadow: none !important;
}

/* Karty sesji/urządzeń - ciemne tło, jasny tekst */
.cpd-theme-light .mx_UserSettingsDialog .mx_FilteredDeviceList_listItem *,
.cpd-theme-light .mx_UserSettingsDialog .mx_DeviceTile *,
.cpd-theme-light .mx_UserSettingsDialog .mx_FilteredDeviceListHeader * {
    color: #f0f0f0 !important;
}

/* Linki w Settings */
.cpd-theme-light .mx_TabbedView_tabPanel a {
    color: #CE1D39 !important;
}

/* Toggle - aktywny stan czerwony */
.cpd-theme-light [role="switch"][aria-checked="true"] {
    background-color: #CE1D39 !important;
}

/* Separator */
.cpd-theme-light hr,
.cpd-theme-light .mx_SettingsSection_divider {
    border-color: #e0e0e0 !important;
}

/* ===== MODALS ===== */
.mx_Dialog_background {
    background-color: rgba(0, 0, 0, 0.75) !important;
}

/* Dark theme modals */
.cpd-theme-dark .mx_Dialog_border,
.cpd-theme-dark [class*="_glass_"] {
    background: #242424 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #333 !important;
    border-radius: 20px !important;
    color: #f0f0f0 !important;
}

/* Light theme - ciemne modals (nie Settings, nie QuestionDialog) */
.cpd-theme-light .mx_Dialog_border:not(.mx_UserSettingsDialog):not(.mx_QuestionDialog):not([class*="fixedWidth"]),
.cpd-theme-light [class*="_glass_"]:not(.mx_UserSettingsDialog):not(.mx_QuestionDialog) {
    background: #242424 !important;
    backdrop-filter: none !important;
    border: 1px solid #333 !important;
    border-radius: 20px !important;
    color: #f0f0f0 !important;
}

/* Settings dialog - białe tło */
.cpd-theme-light .mx_UserSettingsDialog {
    background: #fff !important;
    border: none !important;
}

/* QuestionDialog (Sign out itp.) - białe */
.cpd-theme-light .mx_QuestionDialog {
    background: #fff !important;
}
.cpd-theme-light .mx_QuestionDialog h1,
.cpd-theme-light .mx_QuestionDialog h2,
.cpd-theme-light .mx_QuestionDialog h3,
.cpd-theme-light .mx_QuestionDialog p {
    color: #1a1a1a !important;
}
.cpd-theme-light .mx_QuestionDialog button[data-kind="primary"] {
    background-color: #CE1D39 !important;
    color: #fff !important;
    border-radius: 30px !important;
    border: none !important;
}
.cpd-theme-light .mx_QuestionDialog button[data-kind="secondary"] {
    background: transparent !important;
    border: 1px solid #999 !important;
    color: #1a1a1a !important;
    border-radius: 30px !important;
}

/* fixedWidth dialogs - białe */
.cpd-theme-light .mx_Dialog_border[class*="fixedWidth"] {
    background: #fff !important;
    border: none !important;
}
.cpd-theme-light .mx_Dialog_border[class*="fixedWidth"] h1,
.cpd-theme-light .mx_Dialog_border[class*="fixedWidth"] h2,
.cpd-theme-light .mx_Dialog_border[class*="fixedWidth"] h3,
.cpd-theme-light .mx_Dialog_border[class*="fixedWidth"] p {
    color: #1a1a1a !important;
}
.cpd-theme-light .mx_Dialog_border[class*="fixedWidth"] button[data-kind="primary"] {
    background-color: #CE1D39 !important;
    color: #fff !important;
    border-radius: 30px !important;
    border: none !important;
}
.cpd-theme-light .mx_Dialog_border[class*="fixedWidth"] button[data-kind="secondary"] {
    background: transparent !important;
    border: 1px solid #999 !important;
    color: #1a1a1a !important;
    border-radius: 30px !important;
}

/* Przyciski w ciemnych modalach */
.mx_Dialog_border:not(.mx_UserSettingsDialog):not(.mx_QuestionDialog) button[data-kind="primary"]:not([aria-label]),
[class*="_glass_"] button[data-kind="primary"]:not([aria-label]) {
    background-color: #CE1D39 !important;
    color: #ffffff !important;
    border-radius: 30px !important;
    border: none !important;
}
.mx_Dialog_border:not(.mx_UserSettingsDialog):not(.mx_QuestionDialog) button[data-kind="secondary"],
[class*="_glass_"] button[data-kind="secondary"] {
    background: #2a2a2a !important;
    border: 1px solid #555 !important;
    color: #f0f0f0 !important;
    border-radius: 30px !important;
}
.mx_Dialog_border [class*="_content_"][data-size],
[class*="_glass_"] [class*="_content_"][data-size] {
    background: #333 !important;
    color: #f0f0f0 !important;
    border-radius: 50% !important;
}
.mx_Dialog_border:not(.mx_UserSettingsDialog):not(.mx_QuestionDialog) li,
[class*="_glass_"]:not(.mx_QuestionDialog) li {
    background: #2a2a2a !important;
    border: 1px solid #333 !important;
    color: #f0f0f0 !important;
    border-radius: 10px !important;
}
.mx_Dialog_border a,
[class*="_glass_"] a {
    color: #CE1D39 !important;
}
.mx_Dialog_border .mx_Dialog_cancelButton,
[class*="_glass_"] .mx_Dialog_cancelButton {
    color: #aaa !important;
}
.mx_Dialog_border .mx_Dialog_cancelButton:hover,
[class*="_glass_"] .mx_Dialog_cancelButton:hover {
    color: #f0f0f0 !important;
}

/* Glass modals na auth page - jasne */
.cpd-theme-light .mx_AuthPage [class*="_glass_"] {
    background: #f8f8f8 !important;
    color: #1a1a1a !important;
}
.cpd-theme-light .mx_AuthPage [class*="_glass_"] h1,
.cpd-theme-light .mx_AuthPage [class*="_glass_"] p {
    color: #1a1a1a !important;
}