/**
 * Button Shortcode Styles
 * 
 * Universal styles for the [button] shortcode
 *
 * @package BoxedTheme
 */

/* ==========================================================================
   Base Button Styles
   ========================================================================== */

/* Button Wrapper for Alignment */
.boxedtheme-button-wrapper {
    display: block;
    margin: 20px 0;
}

.boxedtheme-button-wrapper.boxedtheme-button-align-left {
    text-align: left;
}

.boxedtheme-button-wrapper.boxedtheme-button-align-center {
    text-align: center;
}

.boxedtheme-button-wrapper.boxedtheme-button-align-right {
    text-align: right;
}

/* Button Element */
.boxedtheme-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 2px solid transparent;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.boxedtheme-button:hover {
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0.95;
    transform: scale(1.02);
}

.boxedtheme-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.boxedtheme-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Button Text */
.boxedtheme-btn-text {
    display: inline-block;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Button Icon Styles
   ========================================================================== */
.boxedtheme-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.boxedtheme-btn-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    display: block;
}

.boxedtheme-btn-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Icon Position - Right */
.boxedtheme-btn-icon-right {
    flex-direction: row-reverse;
}

/* ==========================================================================
   Button Sizes
   ========================================================================== */

/* Small Button */
.boxedtheme-btn-small {
    padding: 8px 16px;
    font-size: 15px;
    gap: 6px;
}

.boxedtheme-btn-small .boxedtheme-btn-icon {
    width: 16px;
    height: 16px;
}

/* Medium Button (Default) */
.boxedtheme-btn-medium {
    padding: 12px 24px;
    font-size: 20px;
    gap: 8px;
}

.boxedtheme-btn-medium .boxedtheme-btn-icon {
    width: 20px;
    height: 20px;
}

/* Large Button */
.boxedtheme-btn-large {
    padding: 16px 32px;
    font-size: 24px;
    gap: 10px;
}

.boxedtheme-btn-large .boxedtheme-btn-icon {
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   Button Types - Light Mode
   ========================================================================== */

/* Primary Button */
.boxedtheme-btn-primary {
    background-color: var(--primary-color, #e74c3c);
    border-color: var(--primary-color, #e74c3c);
    color: var(--button-text-color, #ffffff);
}

/* Secondary Button */
.boxedtheme-btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

/* Success Button */
.boxedtheme-btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: #ffffff;
}

/* Danger/Error Button */
.boxedtheme-btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #ffffff;
}

/* Warning Button */
.boxedtheme-btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

/* Info Button */
.boxedtheme-btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: #ffffff;
}

/* Light Button */
.boxedtheme-btn-light {
    background-color: #f8f9fa;
    border-color: #f8f9fa;
    color: #212529;
}

/* Dark Button */
.boxedtheme-btn-dark {
    background-color: #343a40;
    border-color: #343a40;
    color: #ffffff;
}

/* Outline Button */
.boxedtheme-btn-outline {
    background-color: transparent;
    border-color: var(--primary-color, #e74c3c);
    color: var(--primary-color, #e74c3c);
}

.boxedtheme-btn-outline:hover::after {
    background: var(--primary-color, #e74c3c);
    opacity: 1;
}

.boxedtheme-btn-outline:hover {
    color: var(--button-text-color, #ffffff);
}

/* Ghost Button */
.boxedtheme-btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--text-color, #333333);
}

/* ==========================================================================
   Dark Mode Button Styles
   ========================================================================== */
body.dark-mode .boxedtheme-btn-secondary {
    background-color: #8a929a;
    border-color: #8a929a;
}

body.dark-mode .boxedtheme-btn-success {
    background-color: #34ce57;
    border-color: #34ce57;
}

body.dark-mode .boxedtheme-btn-danger {
    background-color: #e4606d;
    border-color: #e4606d;
}

body.dark-mode .boxedtheme-btn-warning {
    background-color: #ffd33d;
    border-color: #ffd33d;
    color: #1a1a1a;
}

body.dark-mode .boxedtheme-btn-info {
    background-color: #1fc7e3;
    border-color: #1fc7e3;
}

body.dark-mode .boxedtheme-btn-light {
    background-color: #495057;
    border-color: #495057;
    color: #f8f9fa;
}

body.dark-mode .boxedtheme-btn-dark {
    background-color: #6c757d;
    border-color: #6c757d;
}

body.dark-mode .boxedtheme-btn-ghost {
    color: var(--text-color, #e0e0e0);
}

body.dark-mode .boxedtheme-button:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Full Width Button
   ========================================================================== */
.boxedtheme-button-wrapper.boxedtheme-btn-block,
.boxedtheme-button-wrapper.boxedtheme-button-block {
    display: block;
}

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

/* ==========================================================================
   Disabled State
   ========================================================================== */
.boxedtheme-button:disabled,
.boxedtheme-button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   Loading State (Optional for future use)
   ========================================================================== */
.boxedtheme-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.boxedtheme-button.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-loading-spinner 0.6s linear infinite;
}

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

/* ==========================================================================
   Button Group (Optional)
   ========================================================================== */
.boxedtheme-button-group {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
}

.boxedtheme-button-group .boxedtheme-button-wrapper {
    margin: 0;
}

.boxedtheme-button-group .boxedtheme-button {
    margin: 0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media screen and (max-width: 768px) {
    .boxedtheme-btn-large {
        padding: 14px 28px;
        font-size: 16px;
    }
    
    .boxedtheme-btn-medium {
        padding: 10px 20px;
        font-size: 15px;
    }
    
    .boxedtheme-btn-small {
        padding: 7px 14px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .boxedtheme-button {
        font-size: 14px;
        padding: 10px 18px;
    }
    
    .boxedtheme-btn-large {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    /* Stack buttons vertically on very small screens if in a group */
    .boxedtheme-button-group {
        flex-direction: column;
        width: 100%;
    }
    
    .boxedtheme-button-group .boxedtheme-button-wrapper {
        width: 100%;
        text-align: center;
    }
    
    .boxedtheme-button-group .boxedtheme-button {
        width: 100%;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .boxedtheme-button {
        color: #000 !important;
        background-color: #fff !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        text-decoration: underline;
    }
    
    .boxedtheme-button::after {
        content: " (" attr(href) ")";
        font-size: 12px;
        font-weight: normal;
    }
}