/* =========================================================================
   BUTTONS - Button Component Styles
   ========================================================================= */

/**
 * Button styles extending Bootstrap with BusOva theming.
 * Includes primary actions, variants, sizes, and states.
 */

/* ---------------------------------------------------------------------
   Base Button Style
   --------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    border-radius: 0.45rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    text-decoration: none;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
    cursor: pointer;
}

.btn:hover {
    text-decoration: none;
}

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

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.65;
    pointer-events: none;
}

/* Icon inside buttons */
.btn i,
.btn svg {
    font-size: 0.9em;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   Primary Button
   --------------------------------------------------------------------- */

.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 0.2rem var(--accent-soft);
}

/* ---------------------------------------------------------------------
   Secondary Button
   --------------------------------------------------------------------- */

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
    color: #fff;
}

.btn-secondary:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.25);
}

/* ---------------------------------------------------------------------
   Success Button
   --------------------------------------------------------------------- */

.btn-success {
    background-color: #198754;
    border-color: #198754;
    color: #fff;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
    color: #fff;
}

.btn-success:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

/* ---------------------------------------------------------------------
   Danger Button
   --------------------------------------------------------------------- */

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
    color: #fff;
}

.btn-danger:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* ---------------------------------------------------------------------
   Warning Button
   --------------------------------------------------------------------- */

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #ffca2c;
    border-color: #ffc720;
    color: #212529;
}

.btn-warning:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* ---------------------------------------------------------------------
   Info Button
   --------------------------------------------------------------------- */

.btn-info {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    color: #212529;
}

.btn-info:hover {
    background-color: #31d2f2;
    border-color: #25cff2;
    color: #212529;
}

.btn-info:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(13, 202, 240, 0.25);
}

/* ---------------------------------------------------------------------
   Outline Variants
   --------------------------------------------------------------------- */

.btn-outline-primary {
    border-color: var(--accent);
    color: var(--accent);
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
    background-color: transparent;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
}

.btn-outline-success {
    border-color: #198754;
    color: #198754;
    background-color: transparent;
}

.btn-outline-success:hover {
    background-color: #198754;
    border-color: #198754;
    color: #fff;
}

.btn-outline-danger {
    border-color: #dc3545;
    color: #dc3545;
    background-color: transparent;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.btn-outline-warning {
    border-color: #ffc107;
    color: #ffc107;
    background-color: transparent;
}

.btn-outline-warning:hover {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-outline-info {
    border-color: #0dcaf0;
    color: #0dcaf0;
    background-color: transparent;
}

.btn-outline-info:hover {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    color: #212529;
}

/* ---------------------------------------------------------------------
   Link Button (text-only appearance)
   --------------------------------------------------------------------- */

.btn-link {
    background-color: transparent;
    border-color: transparent;
    color: var(--accent);
    font-weight: 500;
    padding-left: 0;
    padding-right: 0;
}

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

/* ---------------------------------------------------------------------
   Button Sizes
   --------------------------------------------------------------------- */

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 0.35rem;
}

.btn-lg {
    padding: 0.65rem 1.25rem;
    font-size: 1rem;
    border-radius: 0.5rem;
}

/* ---------------------------------------------------------------------
   Button Groups
   --------------------------------------------------------------------- */

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.45rem;
    border-bottom-left-radius: 0.45rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.45rem;
    border-bottom-right-radius: 0.45rem;
}

.btn-group-sm .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* ---------------------------------------------------------------------
   Icon-Only Buttons
   --------------------------------------------------------------------- */

.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 1.75rem;
    height: 1.75rem;
}

.btn-icon.btn-lg {
    width: 2.75rem;
    height: 2.75rem;
}

/* ---------------------------------------------------------------------
   Loading State
   --------------------------------------------------------------------- */

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

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-top: -0.5rem;
    margin-left: -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btnSpinner 0.75s linear infinite;
}

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

/* Restore color for spinner visibility */
.btn-primary.btn-loading::after,
.btn-secondary.btn-loading::after,
.btn-success.btn-loading::after,
.btn-danger.btn-loading::after {
    border-color: #fff;
    border-right-color: transparent;
}

/* ---------------------------------------------------------------------
   Dark Theme Adjustments
   --------------------------------------------------------------------- */

body.theme-dark .btn-secondary {
    background-color: #4b5563;
    border-color: #4b5563;
}

body.theme-dark .btn-secondary:hover {
    background-color: #6b7280;
    border-color: #6b7280;
}

body.theme-dark .btn-outline-secondary {
    border-color: #6b7280;
    color: #9ca3af;
}

body.theme-dark .btn-outline-secondary:hover {
    background-color: #6b7280;
    border-color: #6b7280;
    color: #fff;
}

body.theme-dark .btn-link {
    color: var(--accent);
}

body.theme-dark .btn-link:hover {
    color: var(--accent-hover);
}

/* ---------------------------------------------------------------------
   Responsive Adjustments
   --------------------------------------------------------------------- */

@media (max-width: 576px) {
    /* Full-width buttons on mobile when in flex containers */
    .btn-mobile-full {
        width: 100%;
    }
}
