/* CSS Custom Properties (Variables) for Dynamic Theming */
:root {
    /* Primary colors */
    --primary-color: #5469d4;
    --primary-hover-color: #4358c4;
    --primary-active-color: #3d4eae;

    /* Text colors */
    --text-primary-color: #32325d;
    --text-secondary-color: #8898aa;
    --text-light-color: #6c757d;
    --link-color: #4a5a9d;

    /* Background colors */
    --background-color: #f5f7fa;
    --surface-color: #ffffff;
    --surface-alt-color: #f8f9fa;

    /* Border colors */
    --border-color: #e6ebf1;

    /* Status colors */
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;

    /* Header/Footer */
    --header-background-color: #ffffff;
    --footer-text-color: #8898aa;

    /* Derived colors (computed from status colors) */
    --success-bg-color: #d4edda;
    --success-text-color: #155724;
    --success-border-color: #c3e6cb;
    --error-bg-color: #f8d7da;
    --error-text-color: #721c24;
    --error-border-color: #f5c6cb;
    --warning-bg-color: #fff3cd;
    --warning-text-color: #856404;
    --info-bg-color: #cce5ff;
    --info-text-color: #004085;
    --neutral-bg-color: #e2e3e5;
    --neutral-text-color: #383d41;

    /* Focus state */
    --focus-shadow-color: rgba(84, 105, 212, 0.1);
}

/* Dark Mode Overrides */
body.dark-mode {
    --text-primary-color: #e4e4e7;
    --text-secondary-color: #a1a1aa;
    --text-light-color: #71717a;
    --link-color: #93a3e8;
    --background-color: #18181b;
    --surface-color: #27272a;
    --surface-alt-color: #3f3f46;
    --border-color: #52525b;
    --header-background-color: #27272a;
    --footer-text-color: #a1a1aa;

    /* Dark mode derived colors */
    --success-bg-color: #14532d;
    --success-text-color: #86efac;
    --success-border-color: #166534;
    --error-bg-color: #7f1d1d;
    --error-text-color: #fca5a5;
    --error-border-color: #991b1b;
    --warning-bg-color: #713f12;
    --warning-text-color: #fde047;
    --info-bg-color: #1e3a5f;
    --info-text-color: #7dd3fc;
    --neutral-bg-color: #3f3f46;
    --neutral-text-color: #d4d4d8;

    /* Focus state for dark mode */
    --focus-shadow-color: rgba(84, 105, 212, 0.3);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Internal Scrollbar Styles — thin transparent track on all scroll containers */
main, div, section, article, aside, nav, ul, ol, pre, textarea, .modal-body, .activity-list, .notes-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(199, 200, 255, 0.7) transparent;
}

main::-webkit-scrollbar,
div::-webkit-scrollbar,
section::-webkit-scrollbar,
article::-webkit-scrollbar,
aside::-webkit-scrollbar,
nav::-webkit-scrollbar,
ul::-webkit-scrollbar,
ol::-webkit-scrollbar,
pre::-webkit-scrollbar,
textarea::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.activity-list::-webkit-scrollbar,
.notes-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

main::-webkit-scrollbar-track,
div::-webkit-scrollbar-track,
section::-webkit-scrollbar-track,
article::-webkit-scrollbar-track,
aside::-webkit-scrollbar-track,
nav::-webkit-scrollbar-track,
ul::-webkit-scrollbar-track,
ol::-webkit-scrollbar-track,
pre::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.activity-list::-webkit-scrollbar-track,
.notes-content::-webkit-scrollbar-track {
    background: transparent;
}

main::-webkit-scrollbar-thumb,
div::-webkit-scrollbar-thumb,
section::-webkit-scrollbar-thumb,
article::-webkit-scrollbar-thumb,
aside::-webkit-scrollbar-thumb,
nav::-webkit-scrollbar-thumb,
ul::-webkit-scrollbar-thumb,
ol::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.activity-list::-webkit-scrollbar-thumb,
.notes-content::-webkit-scrollbar-thumb {
    background-color: rgba(199, 200, 255, 0.7);
    border-radius: 4px;
}

main::-webkit-scrollbar-thumb:hover,
div::-webkit-scrollbar-thumb:hover,
section::-webkit-scrollbar-thumb:hover,
article::-webkit-scrollbar-thumb:hover,
aside::-webkit-scrollbar-thumb:hover,
nav::-webkit-scrollbar-thumb:hover,
ul::-webkit-scrollbar-thumb:hover,
ol::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.activity-list::-webkit-scrollbar-thumb:hover,
.notes-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(199, 200, 255, 0.85);
}

/* Link styles */
a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Smooth transitions for interactive elements */
a,
button,
.btn,
[class*="btn-"],
input,
select,
textarea {
    transition: background-color 0.15s ease, border-color 0.15s ease,
                color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

/* Global button styles - centered text (horizontal and vertical) */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-pill,
[class*="btn-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: middle;
}

/* Disabled button states */
button:disabled,
.btn:disabled,
[class*="btn-"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Active press feedback */
button:active:not(:disabled),
.btn:active:not(:disabled),
[class*="btn-"]:active:not(:disabled) {
    transform: translateY(1px);
}

/* Prevent horizontal overflow globally */
html {
    overflow-x: hidden;
}

/* Ensure all images are responsive */
img {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.15);
}

/* Remove border and shadow from logos - logos should never have glow or box shadow */
img.org-header-logo,
img.org-logo-large,
img.logo-preview,
img.org-logo,
img.org-card-logo,
img.header-logo,
.org-logo-img,
[class*="logo"] img,
img[class*="logo"] {
    box-shadow: none !important;
    border: none !important;
    filter: none !important;
}

/* Prevent long words from causing overflow */
p, li, dd, dt, td, th, span, a, label {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.container {
    width: 70%;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

@media (max-width: 768px) {
    .container {
        width: 95%;
    }
}

/* Header */
header {
    text-align: center;
    max-width: 100%;
    overflow: hidden;
}

header:empty {
    display: none;
}

header:has(nav) {
    padding: 30px 0;
    background-color: var(--header-background-color);
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary-color);
}

header nav {
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
}

/* Floating Header - Hidden by default, expands on hover */
.floating-header-wrapper {
    position: fixed;
    top: 0;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.floating-header-tab {
    background-color: #f5f5f0;
    border: 1px solid #d0d0d0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 4px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-header-tab svg {
    transition: transform 0.3s;
    color: #888;
}

.floating-header-wrapper:hover .floating-header-tab svg {
    transform: rotate(180deg);
}

.floating-header {
    position: absolute;
    top: 0;
    right: 0;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    /* Off-white card with dark text — theme-independent */
    background-color: #f5f5f0;
    color: #333;
    border: 1px solid #d0d0d0;
    border-radius: 0 0 12px 12px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 450px;
    white-space: nowrap;
}

/* All floating-header text — dark, theme-independent.
   Uses .floating-header-wrapper prefix for specificity over
   .header-user-info .nav-username and other (0,2,0) rules. */
.floating-header-wrapper .floating-header .org-header-name,
.floating-header-wrapper .floating-header .nav-user-fullname,
.floating-header-wrapper .floating-header .nav-username,
.floating-header-wrapper .floating-header .status-badge {
    color: #333;
}

.floating-header .btn-pill {
    background: #e8e8e3;
    color: #333;
    border: 1px solid #ccc;
}

.floating-header .btn-pill:hover {
    background: #ddd;
}

.floating-header .btn-pill-logout {
    background: #c0392b;
    color: #fff;
    border: 1px solid #c0392b;
}

.floating-header .btn-pill-logout:hover {
    background: #a93226;
}

.floating-header-wrapper:hover .floating-header {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.floating-header-wrapper:hover .floating-header-tab {
    opacity: 0;
    visibility: hidden;
}

.header-logo {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

img.header-logo {
    display: block;
    max-height: 80px;
    max-width: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.header-logo .org-header-logo {
    max-width: 100%;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.header-logo .org-header-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary-color);
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 150px;
}

.header-user-info .nav-user-fullname {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary-color);
}

.header-user-info .nav-username {
    font-size: 13px;
    color: var(--text-secondary-color);
}

.header-user-info .status-badge {
    margin-top: 4px;
}

.header-user-info .nav-links {
    margin-top: 6px;
    font-size: 12px;
}

.header-user-info .nav-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.header-user-info .nav-links a:hover {
    text-decoration: underline;
}

.header-user-info .nav-dot {
    color: var(--text-secondary-color);
    margin: 0 4px;
}

.header-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.header-actions .btn-pill {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary-color);
    transition: background 0.2s;
}

.header-actions .btn-pill:hover {
    background: var(--surface-alt-color);
}

.header-actions .btn-pill-logout {
    background: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

.header-actions .btn-pill-logout:hover {
    background: #c82333;
    border-color: #c82333;
}

/* Legacy Fixed Header - kept for compatibility */
.sticky-header {
    position: fixed;
    top: 20px;
    max-width: 50%;
    z-index: 1000;
    background-color: var(--header-background-color);
    padding: 15px 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 12px rgba(255, 255, 255, 0.1);
    text-align: center;
    border-radius: 8px;
}

.sticky-header-right {
    right: 20px;
    left: auto;
}

/* Horizontal header layout */
.header-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 80px;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    text-align: right;
}

.org-header-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-align: center;
}

/* Legacy two-row header layout (kept for compatibility) */
.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-org-row {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    gap: 15px;
    justify-content: flex-start;
}

.org-header-name {
    flex: 1;
    text-align: center;
    color: var(--text-primary-color);
    font-weight: 600;
    font-size: 15px;
}

.header-nav-row {
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
}

/* Navigation user info section */
.nav-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    background: rgb(236, 235, 255);
    padding: 10px 14px;
    border-radius: 8px;
}

.nav-user-fullname {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary-color);
}

.nav-user-info .status-badge {
    font-size: 10px;
    padding: 2px 8px;
}

.nav-username {
    font-size: 13px;
    color: var(--text-secondary-color);
}

.nav-user-details {
    font-size: 13px;
    color: var(--text-secondary-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-user-details .status-badge {
    font-size: 10px;
    padding: 2px 6px;
}

/* Navigation links with dot delimiter */
.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
}

.nav-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
}

.nav-links a:hover {
    text-decoration: underline;
}

.nav-dot {
    color: var(--text-secondary-color);
    font-size: 14px;
    font-weight: bold;
}

/* Bottom actions with pill buttons */
.nav-bottom-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Pill buttons */
.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    background: rgb(236, 235, 255);
    color: var(--text-primary-color);
    border: 1px solid rgb(220, 218, 245);
}

.btn-pill:hover {
    background: rgb(220, 218, 245);
    border-color: rgb(200, 198, 230);
}

.btn-pill-secondary {
    background: rgb(255, 94, 94);
    color: white;
    border: 1px solid rgb(255, 94, 94);
}

.btn-pill-secondary:hover {
    background: rgb(230, 70, 70);
    color: white;
    border-color: rgb(230, 70, 70);
}

/* Legacy dashboard link (kept for compatibility) */
.nav-dashboard-link {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    text-align: center;
}

.nav-dashboard-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.nav-dashboard-link a:hover {
    text-decoration: underline;
}

.org-header-logo {
    max-width: 100%;
    max-height: 64px;
    width: auto;
    height: auto;
    object-fit: contain;
}


/* Add top padding to body when legacy fixed header is present */
body:has(.sticky-header) {
    padding-top: 80px;
}

/* No padding needed for floating header - it's hidden by default */
body:has(.floating-header-wrapper) {
    padding-top: 0;
}

/* Main Content */
main {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 12px rgba(255, 255, 255, 0.1);
    padding: 30px;
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    color: var(--text-primary-color);
}

/* Surface contrast — nested sections visually distinct from parent */
/* Elements using surface-alt-color get a subtle inset shadow for depth */
[style*="surface-alt-color"],
.settings-section,
.processor-subcard,
.rollup-metric,
.section-header,
.loa-template-slot {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Reusable white child card — sits on the dark main surface */
.content-card {
    background: var(--surface-alt-color, #f0ead0);
    border: 1px solid var(--border-color, #c9a84c);
    border-radius: 8px;
    padding: 30px 25px;
    color: var(--text-primary-color, #003049);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.content-card h1,
.content-card h2,
.content-card h3,
.content-card label {
    color: var(--text-primary-color, #003049);
}

.content-card a {
    color: var(--text-secondary-color, #1a4a64);
}

.content-card input,
.content-card select,
.content-card textarea {
    background: #fff;
    color: var(--text-primary-color, #003049);
}

/* Footer */
footer {
    text-align: center;
    padding: 8px 0;
    color: var(--footer-text-color);
    font-size: 11px;
    flex-shrink: 0;
    line-height: 1.4;
}

footer nav {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Organization Header Section */
.org-header-section {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.org-logo-large {
    max-width: 100%;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 8px;
}

.org-name-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary-color);
    margin: 0;
}

/* Payment Form */
.payment-container {
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.payment-container h2 {
    font-size: 24px;
    margin-bottom: 25px;
    text-align: center;
}

.form-section {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
    padding-bottom: 0;
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary-color);
}

.form-group input,
.form-group select {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    color: var(--text-primary-color);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-shadow-color);
}

.form-group input::placeholder {
    color: var(--text-secondary-color);
}

/* Two column layout */
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 100%;
}

.form-group.half {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

/* Stripe Card Element */
#card-element {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#card-element.StripeElement--focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-shadow-color);
}

#card-element.StripeElement--invalid {
    border-color: var(--error-color);
}

/* Error Message */
.error-message {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 8px;
    min-height: 20px;
}

/* Submit Button — neutralized green */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: #5FA77A;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: #4E966A;
    transform: translateY(-1px);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

.btn-primary:active {
    background-color: #4E966A;
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button — neutralized blue */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #FFFFFF;
    background-color: #5F7FBF;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    text-decoration: none;
}

.btn-secondary:hover {
    background-color: #4E6EAD;
    transform: translateY(-1px);
}

.btn-secondary:active {
    background-color: #4E6EAD;
    transform: translateY(0);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =========================================================================
   Semantic Button Colors (standardized across all templates)
   ========================================================================= */

/* Global text shadow and soft white for button text */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-edit,
.btn-action,
.btn-success,
.btn-payment {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    color: #f0f0f0;
}

/* Yellow edit button keeps dark text */
.btn-edit {
    color: #2a2a2a;
}

/* Serious / Destructive actions (remove, revoke, cancel, delete) — neutralized red */
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: #C96464;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-danger:hover { background-color: #B55353; transform: translateY(-1px); }
.btn-danger:active { background-color: #B55353; transform: translateY(0); }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Edit actions (edit details, resend welcome, reset password) — neutralized yellow */
.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #1F1F1F;
    background-color: #D1B75C;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-edit:hover { background-color: #BFA74E; transform: translateY(-1px); }
.btn-edit:active { background-color: #BFA74E; transform: translateY(0); }
.btn-edit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Non-primary actions (email, Google Meet, external links) — neutralized blue */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: #5F7FBF;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-action:hover { background-color: #4E6EAD; transform: translateY(-1px); }
.btn-action:active { background-color: #4E6EAD; transform: translateY(0); }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Positive actions (submit, agree, approve) — neutralized green */
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: #5FA77A;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-success:hover { background-color: #4E966A; transform: translateY(-1px); }
.btn-success:active { background-color: #4E966A; transform: translateY(0); }
.btn-success:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Payment buttons — neutralized red with white text */
.btn-payment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    background-color: #C96464;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-payment:hover { background-color: #B55353; transform: translateY(-1px); }
.btn-payment:active { background-color: #B55353; transform: translateY(0); }
.btn-payment:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--surface-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Message */
.message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.message.success {
    background-color: var(--success-bg-color);
    color: var(--success-text-color);
    border: 1px solid var(--success-border-color);
}

.message.error {
    background-color: var(--error-bg-color);
    color: var(--error-text-color);
    border: 1px solid var(--error-border-color);
}

/* Hidden class */
.hidden {
    display: none;
}

/* Result Pages */
.result-container {
    text-align: center;
    max-width: 800px;
    margin: auto;
    padding: 20px;
    box-sizing: border-box;
}

.result-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-container.success .result-icon {
    color: var(--success-color);
}

.result-container.failure .result-icon {
    color: var(--error-color);
}

.result-container h2 {
    font-size: 28px;
    margin-bottom: 15px;
}

.result-container.success h2 {
    color: var(--success-color);
}

.result-container.failure h2 {
    color: var(--error-color);
}

.result-message {
    font-size: 16px;
    color: var(--text-light-color);
    margin-bottom: 25px;
}

/* Payment Details */
.payment-details {
    background: var(--surface-alt-color);
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
    text-align: left;
}

.payment-details h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary-color);
}

.payment-details dl {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
}

.payment-details dt {
    font-weight: 500;
    color: var(--text-secondary-color);
}

.payment-details dd {
    color: var(--text-primary-color);
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-pending {
    background-color: var(--warning-bg-color);
    color: var(--warning-text-color);
}

.status-processing {
    background-color: var(--info-bg-color);
    color: var(--info-text-color);
}

.status-completed {
    background-color: var(--success-bg-color);
    color: var(--success-text-color);
}

.status-failed {
    background-color: var(--error-bg-color);
    color: var(--error-text-color);
}

.status-refunded {
    background-color: var(--neutral-bg-color);
    color: var(--neutral-text-color);
}

.status-cancelled {
    background-color: var(--neutral-bg-color);
    color: var(--neutral-text-color);
}

.status-admin {
    background-color: rgba(84, 105, 212, 0.15);
    color: var(--primary-color);
}

/* Confirmation Page Styles */
.confirmation-header {
    text-align: center;
    margin-bottom: 25px;
}

.confirmation-header h3 {
    font-size: 22px;
    color: var(--text-primary-color);
    margin-bottom: 10px;
}

.confirmation-note {
    font-size: 14px;
    color: var(--text-secondary-color);
    margin-bottom: 25px;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.confirm-buttons .btn-edit {
    flex: 1;
}

.confirm-buttons .btn-payment {
    flex: 2;
}

/* Payment Flow Button Styles — fixed semantic colors */
#review-button {
    background-color: #00DE5E;
    color: #003300;
    border: 2px solid #00DE5E;
}

#review-button:hover {
    background-color: #00c754;
    border-color: #00c754;
}

#review-button:active {
    background-color: #00b04a;
    border-color: #00b04a;
}

#submit-button {
    background-color: #F22E2E;
    color: #C7CF00;
    border: 2px solid #F22E2E;
}

#submit-button:hover {
    background-color: #d92626;
    border-color: #d92626;
    color: #C7CF00;
}

#submit-button:active {
    background-color: #c02020;
    border-color: #c02020;
}

#edit-button {
    background-color: #CCC200;
    color: #1a1a00;
    border: 2px solid #CCC200;
}

#edit-button:hover {
    background-color: #b5ac00;
    color: #1a1a00;
}

#edit-button:active {
    background-color: #9e9600;
    border-color: #9e9600;
}

.error-details {
    background: var(--error-bg-color);
    border: 1px solid var(--error-border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.help-text {
    font-size: 14px;
    color: var(--text-light-color);
    margin-bottom: 25px;
}

/* Color Scheme Editor (Owner Only) */
.color-scheme-editor {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

.color-scheme-editor h2 {
    margin-bottom: 30px;
    color: var(--text-primary-color);
}

.color-group {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--surface-alt-color);
    border-radius: 8px;
}

.color-group h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.color-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 100%;
}

.color-input-group label {
    flex: 1;
    min-width: 150px;
    font-size: 14px;
    color: var(--text-primary-color);
    overflow-wrap: break-word;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
}

.color-input-group input[type="text"] {
    width: 100px;
    max-width: 100%;
    padding: 8px;
    font-size: 14px;
    font-family: monospace;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    color: var(--text-primary-color);
    text-transform: uppercase;
    box-sizing: border-box;
}

.color-preview {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Preview Section */
.preview-section {
    margin-top: 40px;
    padding: 20px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
}

.preview-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary-color);
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    main {
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group.half {
        flex: none;
        width: 100%;
        max-width: 100%;
    }

    .payment-details dl {
        grid-template-columns: 1fr;
    }

    .payment-details dt {
        margin-top: 10px;
    }

    .confirm-buttons {
        flex-direction: column;
    }

    .confirm-buttons .btn-edit,
    .confirm-buttons .btn-payment {
        flex: none;
        width: 100%;
    }

    .org-logo-large {
        max-width: 80px;
    }

    .org-name-title {
        font-size: 20px;
    }

    .color-input-group {
        flex-wrap: wrap;
    }

    .color-input-group label {
        flex-basis: 100%;
        margin-bottom: 8px;
        min-width: 100%;
    }

    /* Ensure tables scroll on small screens */
    .table-container {
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Stack navigation items vertically on very small screens if needed */
    header nav {
        word-break: break-word;
    }

    footer nav {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    footer nav span {
        display: none;
    }

    /* Reduce font sizes slightly on small screens to prevent overflow */
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }
}

/* Additional responsive breakpoint for tablets */
@media (max-width: 768px) {
    .form-row {
        flex-wrap: wrap;
    }

    .form-group.half {
        min-width: calc(50% - 8px);
    }

    .color-input-group {
        flex-wrap: wrap;
    }
}

/* Ensure very small screens don't have overflow */
@media (max-width: 320px) {
    .container {
        padding: 10px;
    }

    main {
        padding: 15px;
    }

    .form-group.half {
        min-width: 100%;
    }

    .color-input-group label {
        min-width: 100%;
    }

    .color-input-group input[type="text"] {
        width: 80px;
    }
}

/* Toggle Switch */
.toggle-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-input-group > label:first-child {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--surface-color);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px var(--focus-shadow-color);
}

.toggle-label {
    font-size: 14px;
    color: var(--text-secondary-color);
    min-width: 70px;
}

/* Table Responsiveness - Prevent horizontal overflow */
table {
    width: 100%;
    max-width: 100%;
    table-layout: auto;
}

.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table th,
table td {
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
}

/* Utility classes for overflow prevention */
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.max-w-full {
    max-width: 100%;
}

.word-break {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Ensure pre and code elements don't cause overflow */
pre, code {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Ensure iframes and embedded content are responsive */
iframe, embed, object, video {
    max-width: 100%;
    height: auto;
}

/* Additional overflow prevention for specific elements */
.payment-container,
.result-container,
.color-scheme-editor {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Ensure article content in policy pages doesn't overflow */
article {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

article > div {
    max-width: 100%;
}

article h1, article h2, article h3 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

article ul, article ol {
    max-width: 100%;
    padding-left: 20px;
}

/* Org grid responsiveness improvements */
.org-grid {
    max-width: 100%;
}

/* Ensure buttons don't cause overflow */
button, [class*="btn-"] {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Additional form element safeguards */
input, select, textarea {
    max-width: 100%;
    box-sizing: border-box;
    color: var(--text-primary-color);
    background-color: var(--surface-color);
}

textarea {
    width: 100%;
    resize: vertical;
}

/* ===== Form Validation Styles ===== */
.field-error {
    border-color: var(--error-color) !important;
    background-color: var(--error-bg-color);
}

.field-error:focus {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.form-group .error-message {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

.form-group .error-message:not(:empty) {
    display: block;
}

/* Success state for validated fields */
.field-success {
    border-color: var(--success-color) !important;
}

.field-success:focus {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

/* Password strength indicator */
.password-strength-indicator {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    width: 0;
}

.strength-bar.strength-weak .strength-fill {
    width: 33%;
    background-color: var(--error-color);
}

.strength-bar.strength-medium .strength-fill {
    width: 66%;
    background-color: var(--warning-color);
}

.strength-bar.strength-strong .strength-fill {
    width: 100%;
    background-color: var(--success-color);
}

.strength-text {
    font-size: 13px;
    color: var(--text-secondary-color);
}

.strength-text strong {
    color: var(--text-primary-color);
    text-transform: capitalize;
}

/* ===== Skip to Content Link (Accessibility) ===== */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
    font-weight: 500;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid var(--primary-hover-color);
    outline-offset: 2px;
}

/* ===== Screen Reader Only Content ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ===== Focus Visible Enhancement ===== */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Remove default focus for mouse users, keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ===== Hamburger Menu for Mobile ===== */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 2px solid var(--border-color);
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: var(--surface-alt-color);
    border-color: var(--text-secondary-color);
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 24px;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    background-color: var(--text-primary-color);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:first-child {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:last-child {
    transform: rotate(-45deg) translate(6px, -6px);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .sticky-header .nav-links,
    .sticky-header .nav-bottom-actions {
        display: none;
    }

    .sticky-header.menu-open .nav-links,
    .sticky-header.menu-open .nav-bottom-actions {
        display: flex;
    }

    .sticky-header.menu-open {
        max-width: 90%;
    }

    .header-main {
        position: relative;
    }

    .mobile-menu-toggle {
        position: absolute;
        top: 0;
        right: 0;
    }
}

/* ========================================
   Icon Utility Classes
   ======================================== */

/* Icon sizes - use with img tags */
.icon-xs {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.icon-sm {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.icon-md {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.icon-lg {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.icon-xl {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.icon-2xl {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

/* Icon containers with background */
.icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 8px;
}

.icon-container-sm {
    padding: 4px;
}

.icon-container-lg {
    padding: 12px;
}

/* Icon container backgrounds by type */
.icon-container-success {
    background: rgba(10, 191, 23, 0.15);
}

.icon-container-error {
    background: rgba(239, 68, 68, 0.15);
}

.icon-container-warning {
    background: rgba(245, 158, 11, 0.15);
}

.icon-container-info {
    background: rgba(59, 130, 246, 0.15);
}

.icon-container-neutral {
    background: var(--surface-alt-color);
}

/* Inline icon alignment */
.icon-inline {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-inline-end {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}
