/* Admin Modals Styling - iPadOS Dark Theme */

:root {
    /* Modal Color Palette */
    --modal-bg-primary: rgba(30, 39, 54, 0.8);
    --modal-bg-secondary: rgba(45, 55, 72, 0.6);
    --modal-border-primary: rgba(74, 85, 104, 0.4);
    --modal-border-focus: rgba(59, 130, 246, 0.6);
    --modal-text-primary: #e8eaed;
    --modal-text-secondary: rgba(203, 213, 225, 0.7);
    --modal-text-muted: rgba(203, 213, 225, 0.5);
    
    /* Status Colors */
    --modal-success: rgba(34, 197, 94, 0.8);
    --modal-warning: rgba(251, 191, 36, 0.8);
    --modal-danger: rgba(239, 68, 68, 0.8);
    --modal-info: rgba(59, 130, 246, 0.8);
    
    /* Interactive States */
    --modal-hover-transform: translateY(-1px);
    --modal-focus-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    --modal-transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.form-group-full {
    grid-column: 1 / -1;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e8eaed);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.form-group label .required::after {
    content: " *";
    color: #ff6b6b;
}

/* Form Controls */
.form-control {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    padding: 12px 16px;
    background: var(--modal-bg-secondary);
    border: 1px solid var(--modal-border-primary);
    border-radius: 12px;
    color: var(--modal-text-primary);
    transition: var(--modal-transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.form-control:focus {
    outline: none;
    border-color: var(--modal-border-focus);
    background: rgba(45, 55, 72, 0.8);
    box-shadow: var(--modal-focus-shadow),
                0 2px 8px rgba(0, 0, 0, 0.2);
    transform: var(--modal-hover-transform);
}

.form-control::placeholder {
    color: var(--modal-text-muted);
    font-style: italic;
}

.form-control:read-only {
    background: var(--modal-bg-primary);
    color: var(--modal-text-secondary);
    cursor: not-allowed;
}

/* Form Text */
.form-text {
    font-size: 12px;
    color: rgba(203, 213, 225, 0.6);
    margin-top: 4px;
    font-style: italic;
}

/* Role Selection Styles */
.roles-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.role-checkbox {
    background: rgba(30, 39, 54, 0.6);
    border: 1px solid rgba(74, 85, 104, 0.3);
    border-radius: 12px;
    padding: 16px;
    transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.role-checkbox:hover {
    background: rgba(30, 39, 54, 0.8);
    border-color: rgba(74, 85, 104, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.role-checkbox.role-added {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.1);
}

.role-checkbox.role-removed {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

.role-checkbox.role-unchanged {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

/* Checkbox Labels */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(74, 85, 104, 0.5);
    border-radius: 6px;
    margin-right: 12px;
    margin-top: 2px;
    position: relative;
    flex-shrink: 0;
    background: rgba(30, 39, 54, 0.6);
    transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: rgba(59, 130, 246, 0.8);
    border-color: rgba(59, 130, 246, 0.9);
}

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

.checkbox-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.checkbox-text strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e8eaed);
    margin-bottom: 2px;
}

.checkbox-text small {
    font-size: 12px;
    color: rgba(203, 213, 225, 0.7);
    font-style: italic;
}

/* Role Status Colors */
.role-added .checkbox-text small {
    color: rgba(34, 197, 94, 0.8);
}

.role-removed .checkbox-text small {
    color: rgba(239, 68, 68, 0.8);
}

.role-unchanged .checkbox-text small {
    color: rgba(59, 130, 246, 0.7);
}

/* Users in Role List */
.users-in-role {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 16px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(30, 39, 54, 0.4);
    border: 1px solid rgba(74, 85, 104, 0.3);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.user-item:hover {
    background: rgba(30, 39, 54, 0.6);
    border-color: rgba(74, 85, 104, 0.4);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info strong {
    font-size: 14px;
    color: var(--text-primary, #e8eaed);
    margin-bottom: 2px;
}

.user-info small {
    font-size: 12px;
    color: rgba(203, 213, 225, 0.7);
}

/* Loading and Empty States */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top: 2px solid rgba(59, 130, 246, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 8px auto;
}

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

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    color: rgba(203, 213, 225, 0.7);
    font-size: 14px;
}

.no-roles-available {
    text-align: center;
    padding: 24px;
    color: rgba(203, 213, 225, 0.6);
    font-style: italic;
    background: rgba(30, 39, 54, 0.3);
    border: 1px dashed rgba(74, 85, 104, 0.3);
    border-radius: 12px;
}

.no-users {
    text-align: center;
    padding: 16px;
    color: rgba(203, 213, 225, 0.6);
    font-style: italic;
    font-size: 14px;
}

/* Error States */
.error-message {
    color: #ff6b6b;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
}

/* Success States */
.success-message {
    color: #51cf66;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
    display: flex;
    gap: 4px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: rgba(74, 85, 104, 0.3);
    border-radius: 2px;
    transition: background-color 200ms ease;
}

.strength-bar.weak {
    background: #ff6b6b;
}

.strength-bar.medium {
    background: #ffd43b;
}

.strength-bar.strong {
    background: #51cf66;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .roles-selection {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .role-checkbox {
        padding: 12px;
    }
    
    .checkbox-custom {
        width: 18px;
        height: 18px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 2px;
    }
    
    .role-checkbox {
        border-width: 2px;
    }
    
    .checkbox-custom {
        border-width: 3px;
    }
}

/* Alert Styling */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.alert i {
    font-size: 16px;
    flex-shrink: 0;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: rgba(251, 191, 36, 0.9);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: rgba(239, 68, 68, 0.9);
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: rgba(34, 197, 94, 0.9);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: rgba(59, 130, 246, 0.9);
}

/* Readonly Value Styling */
.readonly-value {
    background: rgba(30, 39, 54, 0.4);
    color: rgba(203, 213, 225, 0.8);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 14px;
    margin: 4px 0 8px 0;
    border: 1px solid rgba(74, 85, 104, 0.2);
}

/* Enhanced Modal Animations */
.modal-backdrop {
    animation: fadeIn 200ms ease-out;
}

.modal-content {
    animation: slideInUp 200ms ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from { 
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Focus states for better accessibility */
.form-control:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.8);
    outline-offset: 2px;
}

.checkbox-label:focus-within .checkbox-custom {
    outline: 2px solid rgba(59, 130, 246, 0.8);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .form-control,
    .role-checkbox,
    .checkbox-custom,
    .user-item {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: rgba(59, 130, 246, 0.8);
    }
    
    .modal-backdrop,
    .modal-content {
        animation: none;
    }
}