/**
 * SSO Integration Styles
 * Styling for SSO login buttons
 */

/* SSO Buttons Container */
.sso-login-buttons {
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;
}

.sso-title {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 500;
}

.sso-buttons-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    justify-content: space-between;
}

.sso-buttons-row:last-child {
    margin-bottom: 0;
}

/* SSO Button Base Styles */
.sso-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: white;
    min-height: 44px;
    position: relative;
    overflow: hidden;
}

.sso-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sso-btn:active {
    transform: translateY(0);
}

.sso-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* Google Button */
.sso-google {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
}

.sso-google:hover {
    background: linear-gradient(135deg, #3367d6, #2d8f47);
}

/* Facebook Button */
.sso-facebook {
    background: linear-gradient(135deg, #1877f2, #42a5f5);
    color: white;
}

.sso-facebook:hover {
    background: linear-gradient(135deg, #166fe5, #1e88e5);
}

/* TikTok Button */
.sso-tiktok {
    background: linear-gradient(135deg, #000000, #ff0050);
    color: white;
}

.sso-tiktok:hover {
    background: linear-gradient(135deg, #1a1a1a, #e6004a);
}

/* Zalo Button */
.sso-zalo {
    background: linear-gradient(135deg, #0068ff, #0084ff);
    color: white;
}

.sso-zalo:hover {
    background: linear-gradient(135deg, #0056d6, #006ee6);
}

.sso-zalo img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* Icons */
.sso-btn i {
    font-size: 16px;
}

/* Loading State */
.sso-btn.loading {
    color: transparent !important;
    pointer-events: none;
}

.sso-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error State */
.sso-btn.error {
    background: #f44336 !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Success State */
.sso-btn.success {
    background: #4caf50 !important;
}

.sso-btn.success::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: white;
    font-weight: bold;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .sso-buttons-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .sso-btn {
        width: 100%;
        padding: 14px 16px;
        font-size: 14px;
        min-height: 48px;
    }
    
    .sso-title {
        font-size: 13px;
        margin-bottom: 12px;
    }
}

/* Integration with existing mobile menu styles */
.login_form .sso-login-buttons {
    margin-top: 15px;
    padding-top: 15px;
}

.login-links + .sso-login-buttons {
    border-top: 1px solid #e0e0e0;
    margin-top: 15px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .sso-login-buttons {
        border-top-color: #333;
    }
    
    .sso-title {
        color: #ccc;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .sso-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .sso-btn {
        transition: none;
    }
    
    .sso-btn:hover {
        transform: none;
    }
    
    .sso-btn.loading::after {
        animation: none;
    }
    
    .sso-btn.error {
        animation: none;
    }
}

/* Focus styles for accessibility */
.sso-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.sso-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Pulse effect for better UX */
.sso-btn:not(.loading):not(.error):not(.success):hover {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1) translateY(-2px); }
    50% { transform: scale(1.05) translateY(-2px); }
    100% { transform: scale(1) translateY(-2px); }
}

/* Tooltip for disabled buttons */
.sso-btn:disabled {
    position: relative;
}

.sso-btn:disabled:hover::before {
    content: 'Chưa cấu hình';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

/* Smooth transitions */
.sso-btn * {
    transition: all 0.3s ease;
}

/* Better spacing in mobile menu */
.mobilewrapper-user .sso-login-buttons {
    margin: 15px 0;
    padding: 15px 0;
}

/* Ensure buttons work well with theme colors */
.login_sidebar .sso-login-buttons {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* RTL Support */
[dir="rtl"] .sso-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .sso-btn i,
[dir="rtl"] .sso-btn img {
    margin-left: 8px;
    margin-right: 0;
}

/* Compact SSO Buttons for smaller forms */
.sso-login-buttons.sso-compact {
    margin: 10px 0;
    padding: 10px 0;
    border-top: 1px solid #e0e0e0;
}

.sso-login-buttons.sso-compact .sso-title {
    font-size: 12px;
    margin-bottom: 8px;
}

.sso-login-buttons.sso-compact .sso-buttons-row {
    justify-content: center;
    gap: 8px;
}

.sso-btn.sso-compact {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 6px;
    font-size: 16px;
    min-height: auto;
}

.sso-btn.sso-compact i {
    font-size: 18px;
}

.sso-btn.sso-compact img {
    width: 18px;
    height: 18px;
}

/* Compact buttons hover effects */
.sso-btn.sso-compact:hover {
    transform: translateY(-1px) scale(1.05);
}

/* Compact buttons in modal forms */
#modal_login_wrapper .sso-login-buttons.sso-compact {
    margin: 15px 0 10px 0;
    padding: 10px 0;
}

/* Compact buttons in topbar */
.topbar .sso-login-buttons.sso-compact {
    margin: 8px 0;
    padding: 8px 0;
}

/* Compact buttons responsive */
@media (max-width: 480px) {
    .sso-login-buttons.sso-compact .sso-buttons-row {
        gap: 6px;
    }

    .sso-btn.sso-compact {
        width: 36px;
        height: 36px;
        padding: 6px;
    }

    .sso-btn.sso-compact i {
        font-size: 16px;
    }

    .sso-btn.sso-compact img {
        width: 16px;
        height: 16px;
    }
}

/* Integration with WordPress default forms */
#loginform .sso-login-buttons,
#registerform .sso-login-buttons {
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #ddd;
}

/* Better integration with theme modal styles */
.modal .sso-login-buttons {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.modal .sso-title {
    color: #555;
}

/* Ensure buttons work in all form contexts */
form .sso-login-buttons {
    width: 100%;
    box-sizing: border-box;
}

/* Loading state for compact buttons */
.sso-btn.sso-compact.loading::after {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Tooltip positioning for compact buttons */
.sso-btn.sso-compact:disabled:hover::before {
    bottom: calc(100% + 5px);
    font-size: 11px;
    padding: 4px 8px;
}

/* SSO Alert Messages */
.login-alert {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.login-alert.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.login-alert.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.login-alert.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Animation for alert messages */
.login-alert {
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Better integration with existing alert styles */
.loginalert .login-alert {
    margin: 0;
    border-radius: 4px;
}

/* Dark mode support for alerts */
@media (prefers-color-scheme: dark) {
    .login-alert.alert-success {
        background-color: #1e4d2b;
        border-color: #2d5a3d;
        color: #a3d9a5;
    }

    .login-alert.alert-danger {
        background-color: #4d1e1e;
        border-color: #5a2d2d;
        color: #d9a3a3;
    }

    .login-alert.alert-info {
        background-color: #1e3a4d;
        border-color: #2d4a5a;
        color: #a3c9d9;
    }
}

/* Responsive alert messages */
@media (max-width: 480px) {
    .login-alert {
        padding: 8px 12px;
        font-size: 13px;
        margin: 8px 0;
    }
}

/* Zalo Callback URL Input Styles */
.zalo-callback-section {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #0068ff;
}

.zalo-callback-section h4 {
    margin: 0 0 10px 0;
    color: #0068ff;
    font-size: 14px;
    font-weight: 600;
}

.zalo-callback-input {
    width: 100%;
    max-width: 500px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
    background: white;
    transition: border-color 0.3s ease;
}

.zalo-callback-input:focus {
    outline: none;
    border-color: #0068ff;
    box-shadow: 0 0 0 2px rgba(0, 104, 255, 0.1);
}

.zalo-callback-description {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.zalo-callback-example {
    margin-top: 10px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: #555;
    word-break: break-all;
}

.zalo-callback-example strong {
    color: #0068ff;
}

/* Copy button for callback URL */
.callback-url-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.copy-btn {
    padding: 4px 8px;
    background: #0068ff;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.copy-btn:hover {
    background: #0056d6;
}

.copy-btn:active {
    background: #004bb5;
}

.copy-success {
    font-size: 11px;
    color: #28a745;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.copy-success.show {
    opacity: 1;
}

/* Responsive design for callback section */
@media (max-width: 768px) {
    .zalo-callback-input {
        max-width: 100%;
        font-size: 13px;
    }

    .zalo-callback-example {
        font-size: 11px;
        padding: 6px 10px;
    }

    .zalo-callback-section {
        padding: 12px;
        margin-top: 12px;
    }
}

/* Integration with existing admin styles */
.form-table .zalo-callback-section {
    margin: 10px 0 0 0;
}

/* Dark mode support for callback section */
@media (prefers-color-scheme: dark) {
    .zalo-callback-section {
        background: #2a2a2a;
        border-left-color: #0084ff;
    }

    .zalo-callback-input {
        background: #333;
        border-color: #555;
        color: #fff;
    }

    .zalo-callback-input:focus {
        border-color: #0084ff;
        box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.2);
    }

    .zalo-callback-example {
        background: #333;
        border-color: #555;
        color: #ccc;
    }

    .zalo-callback-description {
        color: #aaa;
    }
}
