/* Button Component System - Consistent Interactive Elements */
/* Part of UI/UX Audit Recommendation #7: Consolidate Button Styles */

/* Base Button Styles */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Lexend', sans-serif;
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.btn:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn .material-symbols-rounded {
    font-size: 18px;
}

/* Button Variants */

/* Primary - Main actions */
.btn-primary {
    background: var(--brand-primary);
    color: white;
    border: 1px solid transparent;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Secondary - Alternative actions */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--accent-purple);
}

/* Success - Positive actions */
.btn-success {
    background: var(--success);
    color: white;
    border: 1px solid transparent;
}

.btn-success:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(54, 124, 40, 0.3);
}

/* Danger - Destructive actions */
.btn-danger {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(176, 0, 32, 0.1);
}

/* Warning - Caution actions */
.btn-warning {
    background: var(--gradient-orange);
    color: white;
    border: 1px solid transparent;
}

.btn-warning:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(217, 107, 138, 0.3);
}

/* Info - Informational actions */
.btn-info {
    background: var(--gradient-blue);
    color: white;
    border: 1px solid transparent;
}

.btn-info:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(88, 115, 203, 0.3);
}

/* Ghost - Transparent background */
.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Link - Looks like a link */
.btn-link {
    background: transparent;
    color: var(--accent-blue);
    border: none;
    padding: var(--space-1) var(--space-2);
}

.btn-link:hover:not(:disabled) {
    color: var(--accent-purple);
    text-decoration: underline;
}

/* Button Sizes */

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
}

.btn-sm .material-symbols-rounded {
    font-size: 16px;
}

.btn-md {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: 1rem;
}

.btn-lg .material-symbols-rounded {
    font-size: 20px;
}

/* Button Layouts */

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon-only {
    padding: var(--space-2);
    width: 36px;
    height: 36px;
}

.btn-icon-only.btn-sm {
    width: 28px;
    height: 28px;
    padding: var(--space-1);
}

.btn-icon-only.btn-lg {
    width: 44px;
    height: 44px;
    padding: var(--space-3);
}

/* Button Groups */

.btn-group {
    display: inline-flex;
    gap: var(--space-2);
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.btn-group-attached {
    display: inline-flex;
    gap: 0;
}

.btn-group-attached .btn {
    border-radius: 0;
    border-right-width: 0;
}

.btn-group-attached .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group-attached .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-right-width: 1px;
}

/* Icon Positions */

.btn-icon-left .material-symbols-rounded {
    margin-right: var(--space-1);
}

.btn-icon-right .material-symbols-rounded {
    margin-left: var(--space-1);
}

/* Loading State */

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: button-spin 0.6s linear infinite;
}

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

/* Pill Shape */

.btn-pill {
    border-radius: 100px;
}

/* Elevated (with shadow) */

.btn-elevated {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-elevated:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Flat (no border) */

.btn-flat {
    border: none !important;
}

/* ADHD-Specific Variants */

/* High contrast for visibility */
.btn-high-contrast {
    border-width: 2px;
    font-weight: 700;
}

/* Extra padding for easier clicking */
.btn-easy-click {
    padding: var(--space-4) var(--space-6);
    min-height: 48px;
}

/* Visual confirmation on click */
.btn-confirm-click:active:not(:disabled) {
    transform: scale(0.95);
}

/* Semantic Action Buttons */

/* Add/Create actions */
.btn-add {
    background: var(--gradient-green);
    color: white;
}

.btn-add .material-symbols-rounded::before {
    content: 'add';
}

/* Edit actions */
.btn-edit {
    background: var(--gradient-blue);
    color: white;
}

.btn-edit .material-symbols-rounded::before {
    content: 'edit';
}

/* Delete actions */
.btn-delete {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-delete .material-symbols-rounded::before {
    content: 'delete';
}

/* Save actions */
.btn-save {
    background: var(--gradient-purple);
    color: white;
}

.btn-save .material-symbols-rounded::before {
    content: 'save';
}

/* Cancel actions */
.btn-cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cancel .material-symbols-rounded::before {
    content: 'close';
}

/* Special Button Types */

/* Toggle button (active state) */
.btn-toggle {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-toggle.active {
    background: var(--accent-purple);
    color: white;
    border-color: var(--accent-purple);
}

/* Badge button (with count) */
.btn-badge {
    position: relative;
}

.btn-badge::after {
    content: attr(data-badge);
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--accent-red);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
}

/* Responsive Adjustments */

@media (max-width: 768px) {
    .btn {
        font-size: 0.875rem;
        padding: var(--space-2) var(--space-3);
    }

    .btn-lg {
        font-size: 0.9375rem;
        padding: var(--space-3) var(--space-4);
    }

    .btn-block-mobile {
        display: flex;
        width: 100%;
    }

    .btn-group-mobile {
        flex-direction: column;
    }

    .btn-group-mobile .btn {
        width: 100%;
    }
}

/* Print Styles */

@media print {
    .btn {
        display: none;
    }

    .btn-print-visible {
        display: inline-flex !important;
    }
}

/* Dark Mode Support (if implemented) */

@media (prefers-color-scheme: light) {
    .btn-secondary {
        background: #f5f5f5;
        color: #333;
        border-color: #ddd;
    }

    .btn-ghost {
        color: #333;
        border-color: #ddd;
    }
}

/* Accessibility Enhancements */

.btn[aria-pressed="true"] {
    /* Visual indicator for toggle buttons */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn:focus-visible {
    outline: 3px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Reduced Motion */

@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }

    .btn-loading::after {
        animation: none;
    }
}
