/* CMS Button/Link Component Styles */

/* ==========================================
   Base Button/Link Wrapper
   ========================================== */
.cms-buttonlink-wrapper {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 16px;
}

/* ==========================================
   Alignment
   ========================================== */
.cms-buttonlink-align-left {
    text-align: left;
}

.cms-buttonlink-align-center {
    text-align: center;
}

.cms-buttonlink-align-right {
    text-align: right;
}

/* ==========================================
   Link Wrapper
   ========================================== */
.cms-buttonlink-link {
    display: inline-block;
    text-decoration: none;
    color: inherit;
}

.cms-buttonlink-link:hover {
    text-decoration: none;
}

/* ==========================================
   Button Base Styling
   ========================================== */
.cms-buttonlink {
    transition: all 0.2s ease;
    font-weight: 600;
    text-transform: none;
}

/* Hover State */
.cms-buttonlink:hover:not(:disabled) {
    transform: translateY(-1px);
}

/* Active State */
.cms-buttonlink:active:not(:disabled) {
    transform: scale(0.98);
}

/* ==========================================
   Button Style Variants
   ========================================== */

/* Primary Filled (EAA Gold) */
.cms-buttonlink-primaryfilled {
    background-color: #f0b323;
    color: #ffffff;
}

.cms-buttonlink-primaryfilled:hover:not(:disabled) {
    background-color: #d9a520; /* 10% darker */
}

/* Secondary Outlined (EAA Green) */
.cms-buttonlink-secondaryoutlined {
    border-color: #0d5d2c;
    color: #0d5d2c;
}

.cms-buttonlink-secondaryoutlined:hover:not(:disabled) {
    background-color: rgba(13, 93, 44, 0.08);
    border-color: #0a4a23; /* 10% darker */
}

/* Text Link */
.cms-buttonlink-textlink {
    color: #0d5d2c;
    text-decoration: none;
}

.cms-buttonlink-textlink:hover:not(:disabled) {
    text-decoration: underline;
    background-color: transparent;
}

/* ==========================================
   Button Sizes
   ========================================== */
.cms-buttonlink-small {
    font-size: 0.875rem;
    padding: 6px 16px;
}

.cms-buttonlink-medium {
    font-size: 1rem;
    padding: 8px 22px;
}

.cms-buttonlink-large {
    font-size: 1.125rem;
    padding: 10px 28px;
}

/* ==========================================
   Empty State (Placeholder)
   ========================================== */
.cms-buttonlink-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    background-color: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

/* ==========================================
   Edit Mode
   ========================================== */
.cms-buttonlink-edit {
    position: relative;
}

.cms-buttonlink-preview {
    position: relative;
    display: inline-block;
}

.cms-buttonlink-overlay {
    position: absolute;
    top: -8px;
    right: -8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.cms-buttonlink-preview:hover .cms-buttonlink-overlay {
    opacity: 1;
}

.cms-buttonlink-overlay .mud-icon-button {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cms-buttonlink-edit-mode {
    cursor: default;
}

/* ==========================================
   Icon Spacing
   ========================================== */
.cms-buttonlink .mud-icon-button-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================
   Full Width
   ========================================== */
.cms-buttonlink-wrapper .mud-button-root.mud-button-full-width {
    width: 100%;
    display: block;
}

/* ==========================================
   Accessibility
   ========================================== */
.cms-buttonlink:focus-visible {
    outline: 2px solid #f0b323; /* EAA Gold */
    outline-offset: 2px;
}

.cms-buttonlink-link:focus-visible {
    outline: 2px solid #f0b323;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Screen reader only text */
.cms-buttonlink-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;
}

/* ==========================================
   Responsive Behavior
   ========================================== */
@media (max-width: 599px) {
    /* Make all buttons full-width on mobile for better touch targets */
    .cms-buttonlink-wrapper .mud-button-root {
        width: 100%;
    }

    .cms-buttonlink-align-left,
    .cms-buttonlink-align-center,
    .cms-buttonlink-align-right {
        text-align: center;
    }
}

/* ==========================================
   Animation & Transitions
   ========================================== */
.cms-buttonlink-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   Reduced Motion Support
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    .cms-buttonlink,
    .cms-buttonlink-overlay {
        transition: none;
    }

    .cms-buttonlink:hover:not(:disabled),
    .cms-buttonlink:active:not(:disabled) {
        transform: none;
    }

    .cms-buttonlink-content {
        animation: none;
    }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .cms-buttonlink-overlay,
    .cms-buttonlink-edit {
        display: none;
    }

    .cms-buttonlink {
        page-break-inside: avoid;
    }

    /* Show link URL in print */
    .cms-buttonlink-link::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ==========================================
   Icon Picker Styling (in Editor)
   ========================================== */
.cms-buttonlink-icon-picker .mud-paper {
    cursor: pointer;
    transition: all 0.2s ease;
}

.cms-buttonlink-icon-picker .mud-paper:hover {
    background-color: rgba(240, 179, 35, 0.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Disabled State (Future)
   ========================================== */
.cms-buttonlink:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================
   Button Group Spacing (when multiple buttons)
   ========================================== */
.cms-buttonlink-wrapper + .cms-buttonlink-wrapper {
    margin-top: 16px;
}

/* Inline button group (horizontal) */
.cms-buttonlink-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cms-buttonlink-group .cms-buttonlink-wrapper {
    margin-bottom: 0;
}
