/* Topia Water Registration Frontend Styles */

/* Message Styles */
.twr-messages {
    margin-bottom: 20px;
}

.twr-message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-weight: 500;
}

.twr-message.twr-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.twr-message.twr-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.twr-message.twr-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Form Field Validation */
.twr-form-wrapper input.error,
.twr-form-wrapper select.error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.twr-field-error {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 5px;
    display: block;
}

/* Role Description Styling */
.twr-role-description {
    color: #6c757d;
    font-size: 0.85em;
    margin-top: 5px;
    display: block;
    font-style: italic;
}

/* Loading Button States */
.twr-submit-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.twr-submit-btn .btn-loading {
    display: none;
}

.twr-submit-btn.loading .btn-loading {
    display: inline;
}

.twr-submit-btn.loading .btn-text {
    display: none;
}

/* Password Strength Meter */
.password-strength-meter {
    margin-top: 8px;
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.password-strength-indicator {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.password-strength-indicator.weak {
    background-color: #dc3545;
}

.password-strength-indicator.medium {
    background-color: #ffc107;
}

.password-strength-indicator.strong {
    background-color: #28a745;
}

.password-strength-text {
    font-size: 0.75em;
    margin-top: 4px;
    color: #6c757d;
}

/* Form Switcher Styles */
.twr-forgot-password-wrapper,
.twr-registration-wrapper {
    display: none;
}
.twr-back-to-login {
    color: #007cba;
    text-decoration: none;
    font-size: 0.9em;
}

.twr-back-to-login:hover {
    text-decoration: underline;
}

/* User Dashboard Styles */
.twr-user-dashboard {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin: 20px 0;
}

.twr-dashboard-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .twr-dashboard-content {
        grid-template-columns: 1fr 1fr;
    }
}

.user-info, .user-regions {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.user-info h3, .user-regions h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.user-regions ul {
    list-style: none;
    padding: 0;
}

.user-regions li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.user-regions li:last-child {
    border-bottom: none;
}

.status-active {
    color: #28a745;
    font-weight: 600;
}

.status-pending {
    color: #ffc107;
    font-weight: 600;
}

.status-inactive {
    color: #dc3545;
    font-weight: 600;
}

.dashboard-actions {
    grid-column: 1 / -1;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* Form Styling to Match Theme */
.twr-form-wrapper .content-text {
    position: relative;
}

.twr-form-wrapper form ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.twr-form-wrapper form ul li {
    margin-bottom: 20px;
}

.twr-form-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.twr-form-wrapper input[type="text"],
.twr-form-wrapper input[type="email"],
.twr-form-wrapper input[type="password"],
.twr-form-wrapper select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background-color: white;
}

.twr-form-wrapper input:focus,
.twr-form-wrapper select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.twr-form-wrapper .required {
    color: #e74c3c;
}

/* Checkbox Styling */
.remember-forgot label,
.free-account label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.remember-forgot input[type="checkbox"],
.free-account input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    transform: scale(1.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .twr-form-wrapper .col-lg-6 {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .twr-user-dashboard {
        padding: 20px;
    }
    
    .twr-dashboard-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Loading Spinner */
.twr-submit-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility Improvements */
.twr-form-wrapper input:focus,
.twr-form-wrapper select:focus,
.twr-form-wrapper button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.twr-form-wrapper button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Form Animation */
.twr-form-wrapper {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success States */
.twr-form-wrapper input.success {
    border-color: #28a745;
    background-image: url('data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%2328a745"><path d="M13.854 3.646a.5.5 0 0 1 0 .708L6.5 11.707a.5.5 0 0 1-.708 0L2.646 8.561a.5.5 0 1 1 .708-.708L6 10.5l6.646-6.647a.5.5 0 0 1 .708 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

/* Dark theme compatibility */
.dark_bg .twr-form-wrapper input,
.dark_bg .twr-form-wrapper select {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.dark_bg .twr-form-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.dark_bg .twr-form-wrapper label {
    color: white;
}