/* Enhanced Common CSS for Login Pages - Extracted from JSP files */

/* Auto-fill detection animations */
@keyframes autofill {
    to {
        color: inherit;
        background: inherit;
    }
}

input:-webkit-autofill {
    animation: autofill 0s forwards;
}

/* Form validation states */
.is-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Password toggle functionality */
.toggle-password {
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
    z-index: 10;
    position: absolute !important;
    display: inline-block !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    height: auto !important;
    width: auto !important;
    font-size: 20px !important;
    vertical-align: middle !important;
    opacity: 1 !important;
}

.toggle-password:hover,
.toggle-password:focus {
    opacity: 0.7;
    background-color: rgba(0, 0, 0, 0.1);
    outline: none;
}

.toggle-password:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.toggle-password.active {
    color: #007bff;
}

/* Input with icon container */
.input-with-icon {
    position: relative;
    width: 100%;
    margin-top: 25px;
    display: block !important;
    margin-bottom: 0;
    height: 40px;
}

.input-with-icon input {
    width: 100%;
    padding-right: 40px !important;
    height: 40px;
    box-sizing: border-box;
}

/* Button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loading {
    position: relative;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alert styles */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Button group styling */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.button-group .btn {
    flex: 1;
    margin: 0;
}

/* Custom Cancel Button Styling - Override Bootstrap */
#cancelBtn,
button.btn-secondary,
.button-group .btn-secondary {
    background-color: transparent !important;
    background-image: none !important;
    color: #3DE0DE !important;
    border: 2px solid #3DE0DE !important;
    box-shadow: none !important;
}

#cancelBtn:hover,
#cancelBtn:focus,
#cancelBtn:active,
button.btn-secondary:hover,
button.btn-secondary:focus,
button.btn-secondary:active,
.button-group .btn-secondary:hover,
.button-group .btn-secondary:focus,
.button-group .btn-secondary:active {
    background-color: #34C2C1 !important;
    background-image: none !important;
    color: white !important;
    border-color: #34C2C1 !important;
    box-shadow: none !important;
}

#cancelBtn:disabled,
button.btn-secondary:disabled,
.button-group .btn-secondary:disabled {
    background-color: transparent !important;
    background-image: none !important;
    color: #3DE0DE !important;
    border-color: #3DE0DE !important;
    opacity: 0.6 !important;
    box-shadow: none !important;
}

/* Responsive button styling for smaller screens */
@media (max-width: 576px) {
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .button-group .btn {
        flex: none;
        width: 100%;
    }
    
    .toggle-password {
        right: 8px;
        font-size: 18px;
    }
}

/* Password toggle tooltip */
.toggle-password::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    right: 0;
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2;
}

.toggle-password:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Header styling */
.header {
    background-color: #004165;
    width: 100%;
    color: #FFFFFF;
    font-weight: bold;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.header img {
    height: 40px;
    margin-right: 10px;
}

.header-title {
    margin: 0;
    font-size: 16px;
    text-align: center;
    flex-grow: 1;
}

/* Form container */
.form-signin {
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
    padding: 0;
    float: none;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.personal-pages {
    border: 2px solid #FC335F;
    margin-top: 10%;
    padding: 30px;
    float: left;
    width: 100%;
}

/* Page layout */
.page-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.container {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    text-align: center;
}

/* Live region for screen reader announcements */
#live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enhanced mobile responsive styles */
@media (max-width: 767px) {
    .form-signin {
        max-width: 300px;
    }
    
    .personal-pages {
        padding: 12px;
        margin-top: 5%;
    }
    
    .header {
        padding: 10px;
    }
    
    .header img {
        height: 35px;
        margin-right: 8px;
    }
    
    .header-title {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 5px;
    }
    
    .header img {
        height: 30px;
    }
    
    .header-title {
        font-size: 12px;
    }
    
    .form-signin input, 
    .form-signin button {
        font-size: 12px;
        padding: 8px;
    }
}