/* ============================================
   Theme & Accent Colour System
   ============================================ */

:root {
    /* Default Accent - Blue */
    --accent-primary: #0078d4;
    --accent-hover: #106ebe;
    --accent-light: #e1f0ff;
    --accent-dark: #004578;
}

/* Accent Colour Variations */
[data-accent="blue"] {
    --accent-primary: #0078d4;
    --accent-hover: #106ebe;
    --accent-light: #e1f0ff;
    --accent-dark: #004578;
}

[data-accent="cyan"] {
    --accent-primary: #00b7c3;
    --accent-hover: #009ca6;
    --accent-light: #ccf2f4;
    --accent-dark: #006b75;
}

[data-accent="teal"] {
    --accent-primary: #00b294;
    --accent-hover: #00957a;
    --accent-light: #ccf1e9;
    --accent-dark: #006755;
}

[data-accent="green"] {
    --accent-primary: #00cc6a;
    --accent-hover: #00a854;
    --accent-light: #ccf5de;
    --accent-dark: #00783c;
}

[data-accent="lime"] {
    --accent-primary: #bad80a;
    --accent-hover: #9ab307;
    --accent-light: #f1f8cc;
    --accent-dark: #6a7d04;
}

[data-accent="yellow"] {
    --accent-primary: #ffb900;
    --accent-hover: #d99700;
    --accent-light: #fff5cc;
    --accent-dark: #996800;
}

[data-accent="orange"] {
    --accent-primary: #ff8c00;
    --accent-hover: #d97500;
    --accent-light: #ffe8cc;
    --accent-dark: #994d00;
}

[data-accent="red"] {
    --accent-primary: #e81123;
    --accent-hover: #c50f1f;
    --accent-light: #fbcdd1;
    --accent-dark: #8b0a14;
}

[data-accent="pink"] {
    --accent-primary: #e3008c;
    --accent-hover: #bf0077;
    --accent-light: #f8cce6;
    --accent-dark: #85004d;
}

[data-accent="magenta"] {
    --accent-primary: #bf0077;
    --accent-hover: #9f0063;
    --accent-light: #f2cce3;
    --accent-dark: #6f0045;
}

[data-accent="purple"] {
    --accent-primary: #8764b8;
    --accent-hover: #6f4d9b;
    --accent-light: #e5dff2;
    --accent-dark: #4d3568;
}

[data-accent="indigo"] {
    --accent-primary: #5b62c1;
    --accent-hover: #4850a3;
    --accent-light: #dfe1f5;
    --accent-dark: #323871;
}

/* Apply accent to primary elements */
.btn-primary,
.primary-nav-link.active,
.badge.bg-primary,
.text-primary {
    background-color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    color: white !important;
    border-radius: 6px;
}

.btn-primary:hover {
    background-color: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
}

/* Outline-primary toggle button groups (e.g. Add Fee's Distribution Method) */
.btn-outline-primary {
    color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
}

.btn-check:checked + .btn-outline-primary,
.btn-check:active + .btn-outline-primary,
.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary:hover {
    background-color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    color: white !important;
}

.btn-check:focus + .btn-outline-primary,
.btn-outline-primary:focus {
    box-shadow: 0 0 0 0.25rem var(--accent-light) !important;
}

/* --accent-light has no dark-mode variant (CLAUDE.md) — use accent-dark for the focus ring instead */
[data-theme="dark"] .btn-check:focus + .btn-outline-primary,
[data-theme="dark"] .btn-outline-primary:focus {
    box-shadow: 0 0 0 0.25rem var(--accent-dark) !important;
}

.text-primary {
    color: var(--accent-primary) !important;
    background-color: transparent !important;
    border-color: transparent !important;
}

/* Pagination active page follows accent colour */
.pagination .page-item.active .page-link {
    background-color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    color: white !important;
}

.pagination .page-item.active .page-link:hover,
.pagination .page-item.active .page-link:focus {
    background-color: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
}

/* ============================================
   Profile Dropdown Sections
   ============================================ */

.dropdown-section {
    padding: 0.5rem 0.625rem;
}

.dropdown-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding: 0;
}

.dropdown-section-title i {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Theme Selector */
.theme-selector {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card); /* #f0f0f0 */
    padding: 0.25rem;
    border-radius: 6px;
    margin: 0;
}

.theme-btn {
    flex: 1;
    padding: 0.3rem 0.5rem;
    border: none;
    background: transparent;
    color: #605e5c;
    font-size: 0.75rem;
    font-weight: 400;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.theme-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05);
    color: #323130;
}

.theme-btn.active {
    background: var(--accent-primary);
    color: white;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 6px;
    margin: 0;
}

.language-btn {
    flex: 1;
    padding: 0.3rem 0.5rem;
    border: none;
    background: transparent;
    color: #605e5c;
    font-size: 0.75rem;
    font-weight: 400;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.language-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05);
    color: #323130;
}

.language-btn.active {
    background: var(--accent-primary);
    color: white;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Accent Colour Grid */
.accent-colour-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.375rem;
    margin: 0;
}

.accent-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.accent-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.accent-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 0.875rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ============================================
   User Profile Blade — touch-friendly overrides
   (scoped to .blade-panel so the desktop dropdown is unaffected)
   ============================================ */

.profile-blade-row {
    border-bottom: 1px solid var(--border-color);
}

.profile-blade-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.profile-blade-link:hover,
.profile-blade-link:active {
    background: var(--bg-card);
    color: inherit;
}

.profile-blade-info {
    flex: 1;
    min-width: 0;
}

.profile-blade-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-blade-sub {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-blade-cta {
    margin-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.blade-pref-section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Re-use dropdown-section-title styles but as blade-pref-label */
.blade-pref-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.blade-pref-label i {
    font-size: 0.875rem;
}

/* Bigger theme/language buttons in the blade */
.blade-panel .theme-selector,
.blade-panel .language-selector {
    width: 100%;
    gap: 0.375rem;
}

.blade-panel .theme-btn,
.blade-panel .language-btn {
    padding: 0.65rem 0.5rem;
    font-size: 0.9rem;
    min-height: 44px;
}

/* Bigger accent swatches in the blade */
.blade-panel .accent-colour-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.blade-panel .accent-btn {
    width: 100%;
    aspect-ratio: 1;
    min-width: 36px;
    min-height: 36px;
}

/* Language switcher section inside blade needs no extra padding */
.blade-pref-section .dropdown-section {
    padding: 0;
}

/* User Dropdown Adjustments */
.user-dropdown {
    min-width: 260px;
    max-width: 280px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    padding: 0.375rem;
    overflow: hidden;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.user-dropdown .dropdown-header {
    padding: 0.5rem 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: transparent;
    border: none;
    margin-bottom: 0;
}

.user-dropdown .dropdown-divider {
    margin: 0.375rem 0;
    border-color: var(--border-color);
    opacity: 1;
}

.user-dropdown .dropdown-item {
    padding: 0.5rem 0.75rem;
    margin: 0.125rem 0;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: all 0.15s ease;
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
}

.user-dropdown .dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.user-dropdown .dropdown-item i {
    width: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.user-dropdown .dropdown-item:hover i {
    color: var(--text-primary);
}

/* ============================================
   Modern Checkbox Styles with Accent Colours
   ============================================ */

/* Regular checkboxes */
.form-check-input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid #d1d1d1;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.form-check-input[type="checkbox"]:hover:not(:disabled) {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.form-check-input[type="checkbox"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-light);
    outline: none;
}

/* Regular checkboxes only (not switches) */
.form-check:not(.form-switch) .form-check-input[type="checkbox"]:checked,
input[type="checkbox"].form-check-input:not(.form-switch .form-check-input):checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
    background-size: 70%;
    background-position: center;
    background-repeat: no-repeat;
}

.form-check:not(.form-switch) .form-check-input[type="checkbox"]:checked:hover,
input[type="checkbox"].form-check-input:not(.form-switch .form-check-input):checked:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.form-check-input[type="checkbox"]:indeterminate {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8z'/%3e%3c/svg%3e");
    background-size: 70%;
    background-position: center;
    background-repeat: no-repeat;
}

.form-check-input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #d1d1d1;
}

.form-check-input[type="checkbox"]:disabled:checked {
    background-color: #d1d1d1;
    border-color: #d1d1d1;
}

/* Form Switch Styles (Toggle Switches) - Professional iOS-style */
.form-switch {
    padding-left: 0;
    display: flex;
    align-items: center;
    min-height: 1.5rem;
}

.form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    background-color: #ced4da;
    background-image: none;
    border: none;
    border-radius: 1.5rem;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease-out;
    flex-shrink: 0;
    overflow: hidden;
}

.form-switch .form-check-input:hover:not(:disabled) {
    background-color: #adb5bd;
}

.form-switch .form-check-input::before,
.form-switch .form-check-input::after {
    content: '';
    position: absolute;
    top: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease-out;
}

.form-switch .form-check-input::before {
    left: 2px;
    opacity: 1;
}

.form-switch .form-check-input::after {
    left: 2px;
    opacity: 0;
    transform: translateX(1.5rem);
}

.form-switch .form-check-input:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    background-image: none !important;
    background-size: auto;
    background-position: center;
}

.form-switch .form-check-input:checked:hover:not(:disabled) {
    background-color: var(--accent-hover);
}

.form-switch .form-check-input:checked::before {
    opacity: 0;
}

.form-switch .form-check-input:checked::after {
    opacity: 1;
}

.form-switch .form-check-input:focus {
    border: none;
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(var(--accent-primary-rgb), 0.15);
}

.form-switch .form-check-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e9ecef;
}

.form-switch .form-check-input:disabled::before {
    box-shadow: none;
}

.form-switch .form-check-label {
    margin-left: 0.625rem;
    cursor: pointer;
    user-select: none;
    line-height: 1.5;
}

.form-switch .form-check-input:disabled + .form-check-label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dark mode adjustments */
[data-theme="dark"] .form-check-input[type="checkbox"] {
    border-color: #605e5c;
    background-color: #252423;
}

[data-theme="dark"] .form-check-input[type="checkbox"]:hover:not(:disabled) {
    border-color: var(--accent-primary);
}

[data-theme="dark"] .form-check-input[type="checkbox"]:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Dark mode form switches */
[data-theme="dark"] .form-switch .form-check-input {
    background-color: #3b3a39;
}

[data-theme="dark"] .form-switch .form-check-input:hover:not(:disabled) {
    background-color: #484644;
}

[data-theme="dark"] .form-switch .form-check-input::before {
    background-color: #8a8886;
}

[data-theme="dark"] .form-switch .form-check-input:checked {
    background-color: var(--accent-primary);
}

[data-theme="dark"] .form-switch .form-check-input:checked::before {
    background-color: #ffffff;
}

[data-theme="dark"] .form-switch .form-check-input:checked:hover:not(:disabled) {
    background-color: var(--accent-hover);
}

[data-theme="dark"] .form-switch .form-check-input:disabled {
    background-color: #3b3a39;
    opacity: 0.4;
}

/* Larger checkboxes for table headers */
#selectAll {
    width: 1.25rem;
    height: 1.25rem;
}

/* Property checkboxes in table */
.property-checkbox {
    margin: 0;
}

/* Animation for checkbox check */
@keyframes checkboxCheck {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.form-check-input[type="checkbox"]:checked {
    animation: checkboxCheck 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Zone Color Selector
   ============================================ */

.zone-color-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}

.zone-color-option {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.zone-color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.zone-color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.zone-color-option label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: bold;
}

.zone-color-option label::after {
    content: '✓';
    color: white;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.zone-color-option input[type="radio"]:checked + label {
    opacity: 1;
}

.zone-color-option input[type="radio"]:checked ~ label::before {
    content: '';
    position: absolute;
    width: 34px;
    height: 34px;
    border: 3px solid white;
    border-radius: 6px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Dark mode adjustments */
[data-theme="dark"] .zone-color-option {
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .zone-color-option:hover {
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .theme-btn:not(.active),
[data-theme="dark"] .language-btn:not(.active) {
    color: #7a7775;
}

[data-theme="dark"] .theme-btn:hover:not(.active),
[data-theme="dark"] .language-btn:hover:not(.active) {
    color: #a19f9d;
}

/* Invoice header row in billing history tables */
.invoice-header-row {
    background-color: rgba(0, 0, 0, 0.05) !important;
}
[data-theme="dark"] .invoice-header-row {
    background-color: rgba(255, 255, 255, 0.13) !important;
}
