/**
 * CBD Quizes Registration & Login Forms
 * Frontend styling for user registration and authentication
 */

/* Container styling */
.cbd-registration-container,
.cbd-login-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.cbd-login-container {
    max-width: 400px;
}

/* Form styling */
.cbd-form h3 {
    margin: 0 0 15px 0;
    text-align: center;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

/* Form header styling */
.cbd-form-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.cbd-form-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.cbd-form-header a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.cbd-form-header a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Messages - Hide inline messages, we use overlays instead */
.cbd-form-messages,
#standalone-login-message,
#standalone-registration-message {
    display: none !important;
}

.cbd-message {
    padding: 12px 16px;
    margin-bottom: 15px;
    font-weight: 500;
}

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

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

/* Form layout */
.cbd-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.cbd-form-field {
    margin-bottom: 20px;
}

.cbd-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.required {
    color: #dc3545;
    font-weight: bold;
}

/* Input styling */
.cbd-form-field input[type="text"],
.cbd-form-field input[type="email"],
.cbd-form-field input[type="password"],
.cbd-form-field input[type="date"],
.cbd-form-field select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e1e5e9;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.cbd-form-field input:focus,
.cbd-form-field select:focus {
    outline: none;
    border-color: #0073aa;
}

/* Removed default :invalid/:valid styling to avoid immediate error/valid states.
   Validation styling is now controlled via JS-added classes (.field-error / .field-success). */

/* Small text styling */
.cbd-form-field small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Checkbox styling */
.cbd-form-field input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

.cbd-form-field label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;

    a {
        margin-left: 4px;
    }
}

/* Button styling */
.cbd-form-actions {
    margin-top: 30px;
    text-align: center;
}

.cbd-btn {
    display: inline-block;
    padding: 12px 30px;
    border: 1px solid;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
    min-width: 120px;
}

.cbd-btn-primary {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.cbd-btn-primary:hover {
    background-color: #005a87;
    border-color: #005a87;
}

.cbd-btn:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    border-color: #e9ecef;
    cursor: not-allowed;
}

/* Loading state */
.cbd-btn .btn-loading {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.cbd-btn.loading .btn-text {
    opacity: 0;
}

.cbd-btn.loading .btn-loading {
    display: block !important;
}

/* Footer styling */
.cbd-form-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
    text-align: center;
}

.cbd-form-footer p {
    margin: 5px 0;
    color: #666;
}

.cbd-form-footer a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
}

.cbd-form-footer a:hover {
    text-decoration: underline;
}

/* Validation styling */
.field-error {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
}

.field-success {
    border-color: #28a745 !important;
    background-color: #f8fff9;
}

.error-message {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #dc3545;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    .cbd-registration-container,
    .cbd-login-container {
        margin: 10px;
        padding: 20px;
    }
    
    .cbd-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .cbd-form h3 {
        font-size: 20px;
    }
    
    .cbd-form-field input[type="text"],
    .cbd-form-field input[type="email"],
    .cbd-form-field input[type="password"],
    .cbd-form-field input[type="date"],
    .cbd-form-field select {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .cbd-registration-container,
    .cbd-login-container {
        margin: 5px;
        padding: 15px;
    }
    
    .cbd-btn {
        width: 100%;
        padding: 14px;
    }
}

/* Overlay Message Styling - Flat Design */
#cbd-overlay-message {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#cbd-overlay-message.show {
    display: flex !important;
}

.cbd-overlay-content {
    background: #fff;
    padding: 24px 32px;
    border-radius: 4px;
    max-width: 400px;
    text-align: center;
    font-size: 16px;
    font-weight: 400;
    animation: fadeIn 0.2s ease-out;
}

.cbd-overlay-content.cbd-success {
    background-color: #4CAF50;
    color: #ffffff;
}

.cbd-overlay-content.cbd-error {
    background-color: #f44336;
    color: #ffffff;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
} 