/**
 * Frontend CSS for Keycloak Magic Link Plugin
 */

/* Button Container */
.kml-button-container {
    margin: 10px 0;
    display: inline-block;
}

/* Base Button Styles */
.kml-magic-link-button {
    background: #0073aa;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    line-height: 1.5;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kml-magic-link-button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.kml-magic-link-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 115, 170, 0.3);
}

.kml-magic-link-button:disabled {
    background: #cccccc;
    color: #666666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Button Styles */
.kml-magic-link-button.kml-style-default {
    background: #0073aa;
}

.kml-magic-link-button.kml-style-default:hover {
    background: #005a87;
}

.kml-magic-link-button.kml-style-primary {
    background: #007cba;
    font-weight: 600;
    padding: 14px 28px;
}

.kml-magic-link-button.kml-style-primary:hover {
    background: #005a87;
}

.kml-magic-link-button.kml-style-secondary {
    background: #ffffff;
    color: #0073aa;
    border: 2px solid #0073aa;
}

.kml-magic-link-button.kml-style-secondary:hover {
    background: #0073aa;
    color: #ffffff;
}

/* Loading State */
.kml-magic-link-button.kml-loading-state {
    pointer-events: none;
}

.kml-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Spinner Animation */
.kml-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-left: 2px solid #ffffff;
    border-radius: 50%;
    animation: kml-spin 1s linear infinite;
}

@keyframes kml-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message Styles */
.kml-error-message,
.kml-success-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.kml-error-message.kml-error {
    background: #fee;
    color: #d63638;
    border: 1px solid #d63638;
}

.kml-success-message.kml-success {
    background: #efe;
    color: #00a32a;
    border: 1px solid #00a32a;
}

/* Login Required Message */
.kml-login-required {
    background: #fff8dc;
    color: #8a6914;
    padding: 12px 16px;
    border: 1px solid #c3aa53;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .kml-magic-link-button {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .kml-button-container {
        display: block;
        width: 100%;
    }
}

/* Focus Styles for Accessibility */
.kml-magic-link-button:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .kml-magic-link-button {
        border: 2px solid;
    }
    
    .kml-magic-link-button:hover {
        outline: 2px solid;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .kml-magic-link-button,
    .kml-spinner {
        transition: none;
        animation: none;
    }
}

/* Custom Button Style Override */
.kml-magic-link-button.kml-style-custom {
    /* Reset styles for custom CSS */
    background: inherit;
    color: inherit;
    border: inherit;
    padding: inherit;
    font-size: inherit;
    border-radius: inherit;
}

/* WordPress Theme Compatibility */
.wp-block-group .kml-button-container,
.entry-content .kml-button-container,
.widget .kml-button-container {
    margin: 16px 0;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .kml-login-required {
        background: #2c2c2c;
        color: #f0e68c;
        border-color: #8a7332;
    }
    
    .kml-error-message.kml-error {
        background: #2c1b1b;
        color: #ff6b6b;
        border-color: #a52a2a;
    }
    
    .kml-success-message.kml-success {
        background: #1b2c1b;
        color: #90ee90;
        border-color: #228b22;
    }
}