/* css/modules/buttons.css */

/* Base Button Styles - Enhanced for ADHD-friendly design */
.btn {
    display: inline-flex; /* Changed to flex for better icon/text alignment */
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Space for icons and text */
    padding: 0.75em 1.5em; /* Increased padding for better touch targets */
    font-weight: 600;
    font-size: 0.95rem; /* Slightly smaller for better proportion */
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent; /* Thicker border for better definition */
    border-radius: 8px; /* Consistent 8px radius */
    box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04); /* Subtle multi-layer shadow */
    transition: all 0.2s ease-out, transform 0.1s ease-out; /* Include transform transition */
    user-select: none;
    white-space: nowrap;
    min-height: 44px; /* Ensure minimum touch target size */
    font-family: inherit;
    position: relative; /* For pseudo-element effects */
}

/* Enhanced hover state with better visual feedback */
.btn:hover {
    transform: translateY(-1px); /* Subtle lift effect */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

/* Active state with satisfying press effect */
.btn:active {
    transform: translateY(0px); /* Return to original position */
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 1px rgba(0,0,0,0.04);
    transition: all 0.1s ease-out; /* Faster transition for immediate feedback */
}

/* Enhanced focus state for accessibility */
.btn:focus-visible {
    outline: 3px solid var(--clr-highlight); /* Thicker outline for better visibility */
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(255, 229, 131, 0.3); /* Glowing effect */
}

/* Disabled state */
.btn:disabled,
.btn--disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

/* Primary Button (.btn--primary) - Enhanced with Gradient */
.btn--primary {
    background-image: linear-gradient(135deg, #5B6DFB 0%, #7E80FF 100%); /* Indigo to lavender gradient */
    color: var(--clr-surface);
    border-color: transparent; /* Clean edge with gradient */
    font-weight: 600;
}

.btn--primary:hover {
    background-image: linear-gradient(135deg, #5B6DFB 0%, #7E80FF 100%); /* Maintain gradient */
    color: var(--clr-surface);
    box-shadow: 0 6px 12px rgba(91, 109, 251, 0.2), 0 3px 6px rgba(91, 109, 251, 0.1);
}

.btn--primary:active {
    background-image: linear-gradient(135deg, #4A5DC7 0%, #6B6DFF 100%); /* Slightly darker for active state */
}

/* Secondary Button (.btn--secondary) - Enhanced with Transparency */
.btn--secondary {
    background-color: transparent; /* Transparent background */
    color: var(--clr-indigo);
    border: 2px solid var(--clr-indigo); /* Indigo border */
}

.btn--secondary:hover {
    background-color: var(--clr-lavender); /* Lavender background on hover */
    color: var(--clr-indigo);
    border-color: var(--clr-indigo);
    box-shadow: 0 4px 8px rgba(91, 109, 251, 0.1), 0 2px 4px rgba(91, 109, 251, 0.05);
}

.btn--secondary:active {
    background-color: #B8BAFF; /* Slightly darker lavender */
    border-color: var(--clr-indigo);
}

/* Success Button (.btn--success) - Enhanced */
.btn--success {
    background-color: var(--clr-mint);
    color: var(--clr-surface);
    border-color: var(--clr-mint);
}

.btn--success:hover {
    background-color: #36A89E; /* Slightly darker mint */
    border-color: #36A89E;
    color: var(--clr-surface);
    box-shadow: 0 4px 8px rgba(68, 193, 184, 0.2), 0 2px 4px rgba(68, 193, 184, 0.1);
}

.btn--success:active {
    background-color: #2B8B83; /* Darker for active state */
    border-color: #2B8B83;
}

/* Warning/Alert Button - New variant */
.btn--warning {
    background-color: var(--clr-highlight);
    color: var(--clr-ink);
    border-color: var(--clr-highlight);
    font-weight: 600;
}

.btn--warning:hover {
    background-color: #FFD93D; /* Slightly darker yellow */
    border-color: #FFD93D;
    color: var(--clr-ink);
    box-shadow: 0 4px 8px rgba(255, 229, 131, 0.2), 0 2px 4px rgba(255, 229, 131, 0.1);
}

/* Ghost/Minimal Button - New variant */
.btn--ghost {
    background-color: transparent;
    color: var(--clr-indigo);
    border: 2px solid transparent;
    box-shadow: none;
}

.btn--ghost:hover {
    background-color: var(--clr-lavender);
    color: var(--clr-indigo);
    box-shadow: 0 2px 4px rgba(91, 109, 251, 0.1);
}

/* Button Size Variants */
.btn--small {
    padding: 0.5em 1em;
    font-size: 0.85rem;
    min-height: 36px;
}

.btn--large {
    padding: 1em 2em;
    font-size: 1.1rem;
    min-height: 52px;
    font-weight: 700;
}

/* Button with icon styling */
.btn .btn-icon {
    font-size: 1.1em;
    line-height: 1;
}

.btn .btn-icon--left {
    margin-right: 0.5rem;
    margin-left: -0.25rem;
}

.btn .btn-icon--right {
    margin-left: 0.5rem;
    margin-right: -0.25rem;
}

/* Icon-only buttons */
.btn--icon-only {
    padding: 0.75em;
    aspect-ratio: 1;
    min-width: 44px;
    border-radius: 50%; /* Keep circular for icon-only buttons for visual distinction */
}

/* Button group styling for navigation buttons */
.btn-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 1 1 auto;
    min-width: 120px; /* Minimum width for readability */
}

/* Special styling for content navigation buttons */
.content-navigation .btn {
    min-width: 140px;
    font-weight: 600;
}

.content-navigation .btn--secondary {
    flex-shrink: 0; /* Prevent shrinking */
}

.content-navigation .btn--primary {
    flex-shrink: 0;
}

/* Loading state for buttons */
.btn--loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Enhanced responsive button styling */
@media (max-width: 768px) {
    .btn {
        padding: 0.65em 1.25em;
        font-size: 0.9rem;
        min-height: 42px;
    }

    .btn--large {
        padding: 0.85em 1.75em;
        font-size: 1rem;
        min-height: 48px;
    }

    .btn--small {
        padding: 0.45em 0.85em;
        font-size: 0.8rem;
        min-height: 34px;
    }

    .btn-group {
        gap: 0.5rem;
    }

    .btn-group .btn {
        min-width: 100px;
    }

    /* Full width buttons on mobile for navigation */
    .content-navigation .btn {
        min-width: 0;
        flex: 1;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.6em 1em;
        font-size: 0.85rem;
        min-height: 40px;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group .btn {
        width: 100%;
        min-width: 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border-width: 3px;
    }

    .btn:focus-visible {
        outline-width: 4px;
    }
}

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

    .btn:hover {
        transform: none;
    }

    .btn:active {
        transform: none;
    }

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