/* SafeJets SSO Plugin Styles */

/* Full Page Loading Overlay */
.safejets-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    backdrop-filter: blur(5px);
}

.safejets-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: safejets-spin 1s linear infinite;
    margin-bottom: 20px;
}

.safejets-loading-text {
    font-size: 18px;
    color: #333;
    font-weight: 500;
    text-align: center;
}

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

/* Toast Notification Styles */
.safejets-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.safejets-toast {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.safejets-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.safejets-toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

.safejets-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.safejets-toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.safejets-toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

.safejets-toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.safejets-toast-close:hover {
    opacity: 1;
}

.safejets-toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    animation: toast-progress 4s linear;
}

@keyframes toast-progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Mobile-specific instruction styling */
.safejets-mobile-instruction {
    background: linear-gradient(135deg, #17a2b8, #138496);
    border-left: 4px solid #0c7489;
}

.safejets-mobile-instruction .safejets-toast-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Success toast variant */
.safejets-toast.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

/* Warning toast variant */
.safejets-toast.warning {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

/* Info toast variant */
.safejets-toast.info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

/* General menu item styling */
.safejets-account-item a,
.safejets-login-item a {
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown container */
.safejets-dropdown {
    position: relative;
    display: inline-block;
}

/* User avatar styling for logged-in users */
.safejets-dropdown-toggle {
    padding: 4px;
    border-radius: 50%;
    border: 2px solid #007cba;
    background: linear-gradient(135deg, #007cba, #005a87);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    cursor: pointer;
}

.safejets-dropdown-toggle:hover {
    border-color: #005a87;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
    transform: translateY(-1px);
}

.safejets-user-avatar {
    border-radius: 50%;
    width: 32px !important;
    height: 32px !important;
    border: 2px solid #ffffff;
    display: block;
}

/* Dropdown menu */
.safejets-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 120px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
}

.safejets-dropdown:hover .safejets-dropdown-menu,
.safejets-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.safejets-dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.safejets-dropdown-item:last-child {
    border-bottom: none;
}

.safejets-dropdown-item:hover {
    background: #f8f9fa;
    color: #007cba;
    text-decoration: none;
}

.safejets-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.safejets-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* Login button specific styling */
#safejets-sso-login {
    position: relative;
    text-decoration: none !important;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 6px;
    padding: 8px 16px;
    margin: 0 5px;
    font-weight: 500;
    border: 1px solid rgba(0, 123, 255, 0.3);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

#safejets-sso-login:hover {
    background: rgba(0, 123, 255, 0.2);
    border-color: rgba(0, 123, 255, 0.5);
    transform: translateY(-1px);
}

#safejets-sso-login:focus {
    outline: 2px solid rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
}

/* Loading state */
#safejets-sso-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading animation for button */
#safejets-sso-login:disabled::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid rgba(0, 123, 255, 0.8);
    border-radius: 50%;
    animation: safejets-spin 1s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .safejets-account-item,
    .safejets-login-item {
        width: 100%;
        text-align: center;
    }
    
    .safejets-dropdown {
        margin: 5px auto;
    }
    
    .safejets-dropdown-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
        min-width: 140px;
    }
    
    .safejets-dropdown:hover .safejets-dropdown-menu,
    .safejets-dropdown-menu.show {
        transform: translateX(-50%) translateY(0);
    }
    
    #safejets-sso-login {
        margin: 5px auto;
        display: inline-block;
        min-height: 44px; /* Better touch target for mobile */
        padding: 12px 20px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
        transition: all 0.3s ease;
    }
    
    #safejets-sso-login:active {
        transform: translateY(1px);
        box-shadow: 0 1px 4px rgba(0, 123, 255, 0.3);
    }
    
    /* Mobile-specific toast adjustments */
    .safejets-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        right: 10px;
    }
    
    .safejets-toast {
        min-width: auto;
        max-width: none;
        margin: 0 0 10px 0;
        font-size: 14px;
    }
    
    .safejets-toast-message {
        font-size: 13px;
        line-height: 1.3;
    }
    
    /* Dropdown items with better touch targets */
    .safejets-dropdown-item {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Loading overlay adjustments for mobile */
    .safejets-loading-text {
        font-size: 16px;
        padding: 0 20px;
        text-align: center;
    }
    
    .safejets-loading-spinner {
        width: 40px;
        height: 40px;
        margin-bottom: 16px;
    }
    
}

@media (max-width: 480px) {
    .safejets-modal-content {
        width: 98%;
        margin: 5px;
    }
    
    .safejets-modal-header {
        padding: 12px;
    }
    
    .safejets-modal-body {
        height: 350px;
    }
}

/* User dropdown styles */
.safejets-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.safejets-user-dropdown.show {
    display: block;
}

.safejets-user-dropdown a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.safejets-user-dropdown a:last-child {
    border-bottom: none;
}

.safejets-user-dropdown a:hover {
    background-color: #f5f5f5;
}

/* Modal styles */
.safejets-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.safejets-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.safejets-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.safejets-modal-overlay.show .safejets-modal-content {
    transform: scale(1);
}

.safejets-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.safejets-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.safejets-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.safejets-modal-close:hover {
    background-color: #e9ecef;
    color: #333;
}

.safejets-modal-body {
    padding: 0;
    height: 500px;
}

#safejets-sso-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Theme compatibility - adjust colors to match common WordPress themes */
.safejets-account-item a,
.safejets-login-item a {
    color: inherit;
}

/* For themes with dark backgrounds */
@media (prefers-color-scheme: dark) {
    .safejets-dropdown-toggle {
        border-color: #4a9eff;
        background: linear-gradient(135deg, #4a9eff, #2980b9);
        box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
    }
    
    .safejets-dropdown-toggle:hover {
        border-color: #2980b9;
        box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
    }
    
    .safejets-dropdown-menu {
        background: #2c3e50;
        border-color: #34495e;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .safejets-dropdown-item {
        color: #ecf0f1;
        border-bottom-color: #34495e;
    }
    
    .safejets-dropdown-item:hover {
        background: #34495e;
        color: #4a9eff;
    }
    
    #safejets-sso-login {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    #safejets-sso-login:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.5);
    }
}