/**
 * Theme Utilities - Theme-aware component styles
 * Purpose: Color-dependent styles using CSS variables from /api/club/theme
 * Load order: After /api/club/theme endpoint and spa.css
 * Contains: btn-primary, btn-secondary, btn-accent, btn-ghost, theme borders
 * Rule: Only classes that use var(--primary-color), var(--secondary-color), etc.
 * 
 * Last Updated: 2025-11-26
 */

:root {
    /* Border colors - adapt to theme luminance */
    --border-color: #e5e7eb;
    --border-color-hover: #d1d5db;
    --border-color-focus: var(--accent-color);
    
    /* Calculated contrast colors (updated by JS) */
    --primary-text: #ffffff;      /* White or black based on primary luminance */
    --secondary-text: #111827;    /* White or black based on secondary luminance */
    --accent-text: #111827;       /* White or black based on accent luminance */
    
    /* Interactive states */
    --primary-hover: var(--primary-light);
    --accent-hover: #fbbf24;  /* Slightly lighter accent */
    
    /* Card opacity - controls transparency of all .card elements */
    --card-opacity: 0.7;  /* 70% default for softer, less saturated look */
}

/* ==================== BUTTONS ==================== */

/* Primary button - Theme-aware with 75% default opacity */
.btn-primary {
    background: color-mix(in srgb, var(--primary-color) 75%, transparent);
    backdrop-filter: blur(10px);
    color: white !important;
    border: 1px solid rgba(0, 0, 0, 0.3);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--primary-color) 85%, transparent);
    transform: translateY(-1px);
}

/* Accent button - Theme-aware with 75% default opacity */
.btn-accent {
    background: color-mix(in srgb, var(--accent-color, #fdb813) 75%, transparent);
    backdrop-filter: blur(10px);
    color: white !important;
    border: 1px solid rgba(0, 0, 0, 0.3);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
}

.btn-accent:hover {
    background: color-mix(in srgb, var(--accent-color, #fdb813) 85%, transparent);
    transform: translateY(-1px);
}

/* Secondary button - Neutral gray, safe for all themes */
.btn-secondary {
    background: #6b7280;
    color: white !important;
    border: 1px solid #6b7280;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-block;
    text-align: center;
    min-width: 100px;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Filter button - Uses secondary color for theme consistency */
.filter-btn {
    background: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    color: var(--secondary-text-color);
}

.filter-btn:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Ghost button - Minimal glass effect with border */
.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    color: var(--primary-color);
    border: 1px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Cancel button - Solid secondary color */
.btn-cancel {
    background: var(--secondary-color, #6b7280);
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-cancel:hover {
    background: color-mix(in srgb, var(--secondary-color, #6b7280) 85%, black);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Action/Accent buttons - Yellow themed for primary actions */
.btn-action {
    background: var(--accent-color, #fdb813);
    color: #000 !important;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-action:hover {
    background: color-mix(in srgb, var(--accent-color, #fdb813) 85%, black);
    transform: translateY(-1px);
}

/* Success buttons - Green for add/confirm actions */
.btn-success {
    background: #10b981;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Warning buttons - Orange for caution actions */
.btn-warning {
    background: #f59e0b;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* Danger buttons - Red for delete/destructive actions */
.btn-danger {
    background: #ef4444;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Edit buttons - Theme primary color */
.btn-edit {
    background: var(--primary-color);
    color: var(--primary-text) !important;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-edit:hover {
    background: color-mix(in srgb, var(--primary-color) 85%, black);
    transform: translateY(-1px);
}

/* Outline buttons - Transparent with theme border */
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color) !important;
    padding: 10px 22px; /* Slightly less to account for border */
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--primary-text) !important;
    transform: translateY(-1px);
}

/* ==================== TABS ==================== */

/* All tab types - Active state uses accent color */
.settings-tab.active,
.filter-tab.active,
.role-tab.active {
    background: var(--accent-color, #fdb813) !important;
    color: var(--accent-text, #111827) !important;
    border-color: var(--accent-color, #fdb813) !important;
}

.settings-tab,
.filter-tab,
.role-tab {
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-700, #374151);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.settings-tab:hover,
.filter-tab:hover,
.role-tab:hover {
    background: var(--gray-200, #e5e7eb);
    cursor: pointer;
}

/* ==================== INPUTS & FORMS ==================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    border-color: var(--border-color);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(253, 184, 19, 0.1);
}

/* ==================== BORDERS ==================== */

.card {
    border-color: var(--border-color);
}

/* ==================== ACCESSIBILITY ==================== */

/* NOTE: Button text colors are dynamically calculated by ThemeTab.js
   to ensure 4.5:1 contrast ratio (WCAG AA compliance) */

/* Focus states for keyboard navigation */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ==================== MODAL THEME COLORS ==================== */
.modal-header {
    background: var(--primary-color) !important;
}

.modal-close-btn {
    color: white !important;
}

.modal-title {
    color: white !important;
}
