/* RSD Authentication System Styles */

/* Auth Prompt Interface */
.rsd-auth-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 500; /* Lower than mood widget (1000) */
    min-width: 250px;
    box-sizing: border-box;
    animation: authPromptSlideUp 0.5s ease-out;
}

@keyframes authPromptSlideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-prompt-content {
    text-align: center;
}

.auth-prompt-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-prompt-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.auth-prompt-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.rsd-auth-prompt h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.rsd-auth-prompt p {
    margin: 0 0 12px 0;
    opacity: 0.9;
    font-size: 0.85rem;
}

.auth-prompt-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin: 0 auto 12px auto;
    display: block;
    width: calc(100% - 20px);
    max-width: 200px;
    box-sizing: border-box;
}

.auth-prompt-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.auth-prompt-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    opacity: 0.9;
}

.feature-icon {
    font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rsd-auth-prompt {
        bottom: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .auth-prompt-features {
        grid-template-columns: 1fr;
    }
}

/* Minimized state */
.rsd-auth-prompt.minimized {
    display: none;
}

/* Restore button */
.rsd-auth-restore {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 500;
    animation: restoreButtonPulse 2s infinite;
    transition: transform 0.3s ease;
}

.rsd-auth-restore:hover {
    transform: scale(1.1);
}

@keyframes restoreButtonPulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Auth Modal */
.rsd-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rsd-modal-content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: rsdModalSlideIn 0.3s ease-out;
}

@keyframes rsdModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rsd-modal-header {
    padding: 24px 24px 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 24px;
    position: relative;
}

.rsd-modal-header h2 {
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 16px;
    text-align: center;
}

.rsd-close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.rsd-close-modal:hover {
    background: #e9ecef;
    color: #495057;
    transform: scale(1.1);
}

.rsd-modal-body {
    padding: 0 24px 24px;
}

/* Auth Tabs */
.rsd-auth-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.rsd-tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s ease;
}

.rsd-tab-btn.active {
    background: #ffffff;
    color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rsd-tab-btn:hover:not(.active) {
    color: #495057;
}

/* Auth Forms */
.rsd-auth-form h3 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
    text-align: center;
}

.rsd-auth-form p {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    margin: 0 0 24px;
    line-height: 1.5;
}

.rsd-form-group {
    margin-bottom: 20px;
}

.rsd-form-group label {
    display: block;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

.rsd-form-group input[type="text"],
.rsd-form-group input[type="email"],
.rsd-form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: #ffffff;
    box-sizing: border-box;
}

.rsd-form-group input[type="text"]:focus,
.rsd-form-group input[type="email"]:focus,
.rsd-form-group input[type="password"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.rsd-form-group input[type="text"]:invalid,
.rsd-form-group input[type="email"]:invalid,
.rsd-form-group input[type="password"]:invalid {
    border-color: #dc3545;
}

/* Custom Checkbox */
.rsd-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
}

.rsd-checkbox input[type="checkbox"] {
    display: none;
}

.rsd-checkbox .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    margin-right: 12px;
    margin-top: 2px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
    background: #ffffff;
}

.rsd-checkbox input[type="checkbox"]:checked + .checkmark {
    background: #007bff;
    border-color: #007bff;
}

.rsd-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.rsd-checkbox a {
    color: #007bff;
    text-decoration: none;
}

.rsd-checkbox a:hover {
    text-decoration: underline;
}

/* Buttons */
.rsd-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rsd-btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.rsd-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

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

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

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    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: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Auth Links */
.rsd-auth-links {
    text-align: center;
    margin-top: 16px;
}

.rsd-auth-links a {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.rsd-auth-links a:hover {
    text-decoration: underline;
}

/* Auth Messages */
.rsd-auth-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.rsd-auth-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.rsd-auth-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.rsd-auth-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.rsd-auth-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* User Greeting */
.rsd-user-greeting {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* Access Restricted State */
.rsd-access-restricted {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.rsd-access-restricted::after {
    content: '🔒 Authentication Required';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 100;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rsd-modal {
        padding: 12px;
    }
    
    .rsd-modal-content {
        max-width: 100%;
    }
    
    .rsd-modal-header,
    .rsd-modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .rsd-modal-header h2 {
        font-size: 20px;
    }
    
    .rsd-auth-form h3 {
        font-size: 18px;
    }
    
    .rsd-form-group input[type="text"],
    .rsd-form-group input[type="email"],
    .rsd-form-group input[type="password"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .rsd-tab-btn {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .rsd-modal-content {
        background: #2c3e50;
        color: #ffffff;
    }
    
    .rsd-modal-header {
        border-bottom-color: #34495e;
    }
    
    .rsd-modal-header h2 {
        color: #ffffff;
    }
    
    .rsd-auth-tabs {
        background: #34495e;
    }
    
    .rsd-tab-btn {
        color: #bdc3c7;
    }
    
    .rsd-tab-btn.active {
        background: #3498db;
        color: #ffffff;
    }
    
    .rsd-auth-form h3 {
        color: #ffffff;
    }
    
    .rsd-auth-form p {
        color: #bdc3c7;
    }
    
    .rsd-form-group label {
        color: #ffffff;
    }
    
    .rsd-form-group input[type="text"],
    .rsd-form-group input[type="email"],
    .rsd-form-group input[type="password"] {
        background: #34495e;
        border-color: #495057;
        color: #ffffff;
    }
    
    .rsd-form-group input[type="text"]:focus,
    .rsd-form-group input[type="email"]:focus,
    .rsd-form-group input[type="password"]:focus {
        border-color: #3498db;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }
    
    .rsd-checkbox {
        color: #bdc3c7;
    }
    
    .rsd-checkbox .checkmark {
        background: #34495e;
        border-color: #495057;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .rsd-modal-content {
        border: 3px solid #000000;
    }
    
    .rsd-form-group input[type="text"],
    .rsd-form-group input[type="email"],
    .rsd-form-group input[type="password"] {
        border-width: 3px;
    }
    
    .rsd-btn-primary {
        background: #000000;
        border: 2px solid #000000;
    }
    
    .rsd-btn-primary:hover {
        background: #333333;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .rsd-modal-content {
        animation: none;
    }
    
    .rsd-btn,
    .rsd-tab-btn,
    .rsd-close-modal,
    .rsd-form-group input,
    .rsd-checkbox .checkmark {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .rsd-modal {
        display: none !important;
    }
}