/**
 * CMA Reddit Skin - Dark Mode
 * Reddit-style dark theme
 */

/* Dark mode is activated by adding .cma-dark-mode class to body */

body.cma-dark-mode {
    /* Dark theme color overrides */
    --cma-bg-primary: #030303;
    --cma-bg-secondary: #1a1a1b;
    --cma-bg-tertiary: #272729;
    --cma-text-primary: #d7dadc;
    --cma-text-secondary: #818384;
    --cma-text-muted: #6a6a6b;
    --cma-border-color: #474748;
    --cma-border-light: #343536;
    --cma-link-color: #4fbcff;
    --cma-card-shadow: 0 2px 4px rgba(0,0,0,0.4);
    --cma-card-shadow-hover: 0 4px 12px rgba(0,0,0,0.6);
}

/* Dark mode adjustments */
body.cma-dark-mode .cma-reddit-theme .cma-content {
    background: var(--cma-bg-primary);
}

body.cma-dark-mode .cma-reddit-dark-toggle {
    background: var(--cma-bg-tertiary);
    border-color: var(--cma-border-color);
}

body.cma-dark-mode .cma-reddit-dark-toggle .sun-icon {
    display: none;
}

body.cma-dark-mode .cma-reddit-dark-toggle .moon-icon {
    display: block;
}

/* Form adjustments for dark mode */
body.cma-dark-mode .cma-reddit-theme input[type="text"],
body.cma-dark-mode .cma-reddit-theme textarea {
    background: var(--cma-bg-tertiary);
    border-color: var(--cma-border-color);
    color: var(--cma-text-primary);
}

body.cma-dark-mode .cma-reddit-theme input[type="text"]:focus,
body.cma-dark-mode .cma-reddit-theme textarea:focus {
    background: var(--cma-bg-secondary);
}

body.cma-dark-mode .cma-reddit-theme input[type="text"]::placeholder,
body.cma-dark-mode .cma-reddit-theme textarea::placeholder {
    color: var(--cma-text-muted);
}

/* Links in dark mode */
body.cma-dark-mode .cma-reddit-theme a {
    color: var(--cma-link-color);
}

body.cma-dark-mode .cma-reddit-theme .cma-thread-title a {
    color: var(--cma-text-primary);
}

body.cma-dark-mode .cma-reddit-theme .cma-thread-title a:hover {
    color: var(--cma-link-color);
}

/* Vote buttons in dark mode */
body.cma-dark-mode .cma-reddit-theme .cma-thumbs-up:hover {
    background: rgba(255, 69, 0, 0.2);
}

body.cma-dark-mode .cma-reddit-theme .cma-thumbs-down:hover {
    background: rgba(113, 147, 255, 0.2);
}

/* Award badges in dark mode */
body.cma-dark-mode .cma-reddit-theme .cma-award-gold {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
}

body.cma-dark-mode .cma-reddit-theme .cma-award-silver {
    background: rgba(192, 192, 192, 0.15);
    color: #c0c0c0;
}

/* Scrollbar styling for dark mode */
body.cma-dark-mode ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

body.cma-dark-mode ::-webkit-scrollbar-track {
    background: var(--cma-bg-primary);
}

body.cma-dark-mode ::-webkit-scrollbar-thumb {
    background: var(--cma-border-color);
    border-radius: 6px;
    border: 3px solid var(--cma-bg-primary);
}

body.cma-dark-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--cma-text-muted);
}

/* Selection color in dark mode */
body.cma-dark-mode ::selection {
    background: rgba(255, 69, 0, 0.3);
    color: white;
}

/* Transition for dark mode toggle */
body.cma-reddit-theme,
body.cma-reddit-theme * {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Prevent transition on initial load */
body.cma-reddit-theme.no-transition,
body.cma-reddit-theme.no-transition * {
    transition: none !important;
}
