/**
 * Patient Referral System - Consolidated CSS
 */

/* ==================== FORM LAYOUT & CONTAINERS ==================== */
.patient-referral-form-container {
    max-width: 95%;
    margin: 2rem auto;
    color: #333;
    padding: 1rem;
}

.form-section {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f1f1;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 10px;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

.form-row .form-group {
    flex: 1 0 45%;
    padding: 0 10px;
    min-width: 250px;
}

.form-actions {
    margin-top: 2rem;
}

/* ==================== LABELS & TEXT ==================== */
.form-group label,
.form-section label,
.checkbox-group > label,
.radio-group > label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bolder;
    color: #fff;
}

.checkbox-group > label,
.radio-group > label {
    font-size: 18px;
    margin-bottom: 15px;
}

.form-group .required {
    color: #fff;
}

/* ==================== INPUTS & CONTROLS ==================== */
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    color: #333;
    transition: border-color 0.3s ease;
}

.responsive-date-input {
    width: 21% !important;
    max-width: 25% !important;
}

@media (max-width: 768px) {
    .responsive-date-input {
        width: 100%;
        max-width: 100%;
    }
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group input[type="date"] {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="date"]:focus {
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.5);
    outline: none;
}

/* ==================== CHECKBOXES ==================== */
.checkbox-group,
.radio-group {
    margin-bottom: 25px;
}

.checkbox-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
}

.checkbox-wrapper {
    position: relative;
    display: block;
    min-width: 250px;
    margin-bottom: 10px;
}

.checkbox-options input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    height: 24px;
    width: 24px;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    z-index: 1;
    cursor: pointer;
}

.checkbox-options label {
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    font-weight: normal;
    color: white;
    display: flex;
    align-items: center;
    font-size: 15px;
    min-height: 24px;
    margin: 0;
    width: 100%;
    line-height: 1.4;
}

.checkbox-options label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.checkbox-options input[type="checkbox"]:checked + label:before {
    background-color: rgb(180, 213, 231);
    border-color: white;
}

.checkbox-options label:after {
    content: '';
    position: absolute;
    left: 9px;
    top: 50%;
    margin-top: -7px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.checkbox-options input[type="checkbox"]:checked + label:after {
    opacity: 1;
}

.checkbox-options input[type="checkbox"]:focus + label:before {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* ==================== RADIO BUTTONS ==================== */
.radio-options {
    display: block;
    gap: 0;
}

.radio-option-wrapper {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 10px;
    clear: both;
}

.radio-options input[type="radio"] {
    position: absolute;
    opacity: 0;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    margin: 0;
    z-index: 1;
}

.radio-options label {
    display: block;
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    font-weight: normal;
    color: white;
    font-size: 15px;
    min-height: 24px;
    margin-bottom: 0;
    width: 100%;
    line-height: 1.4;
}

.radio-options label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
}

.radio-options input[type="radio"]:checked + label:before {
    background-color: rgb(180, 213, 231);
}

.radio-options input[type="radio"]:checked + label:after {
    opacity: 1;
}

.radio-options input[type="radio"]:focus + label:before {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* ==================== FILE UPLOAD ==================== */
.attachments-section {
    transition: height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.file-upload-group {
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
    border: 1px dashed #ccc;
}

.file-upload-group label {
    cursor: pointer;
}

.file-upload-help {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: #777;
}

.file-upload-help p {
    margin: 0.3rem 0;
}

#selected-files {
    margin-top: 1rem;
}

.selected-file {
    display: flex;
    align-items: center;
    background: #ecf0f1;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.selected-file .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-file {
    background: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-left: 8px;
    padding: 0;
    transition: background-color 0.2s, color 0.2s;
}

.remove-file:hover {
    background: #FFBABA;
    color: white;
}

/* ==================== SUBMIT BUTTON ==================== */
/* Updated CSS for the submit button with loading state */
.submit-button {
    position: relative;
    background-color: rgb(180, 213, 231);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: bolder;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: auto;
    display: inline-block;
    min-width: 200px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.submit-button:hover {
    background-color: rgb(150, 193, 216);
}

.submit-button:disabled {
    background-color: #c5d5df;
    cursor: not-allowed;
}

/* Loading state styles */
.submit-button.loading {
    padding-left: 2.5rem; /* Make space for the spinner */
}

.submit-button.loading:before {
    content: "";
    position: absolute;
    left: 1.2rem;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== ERROR & RESPONSE MESSAGES ==================== */
.error-message,
.file-error-message {
    color: #FFBABA;
    font-size: 0.9em;
    margin-top: 5px;
    margin-bottom: 10px;
    display: block;
}

.form-response.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.form-response.error {
    color: #FFBABA;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

/* Success message styling */
.submission-success {
    text-align: center;
    padding: 2rem;
    animation: fadeIn 0.5s ease-in;
}

.success-icon {
    margin-bottom: 1.5rem;
}

.submission-success h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.submission-success p {
    color: #5f6368;
    font-size: 1.1rem;
}

/* Error summary styling */
.error-summary {
    background-color: transparent;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.error-summary ol li {
    font-size: 18px;
}

.error-summary h3 {
    color: #FFBABA;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
}

.error-summary ul {
    margin: 0;
    padding-left: 20px;
}

.error-summary li {
    color: #FFBABA;
    margin-bottom: 5px;
}

/* ==================== PORTAL STYLES ==================== */
.patient-referral-portal {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 20px auto;
    padding: 0;
}

.patient-referral-portal h1 {
    font-size: 24px;
    padding: 20px;
    margin: 0;
    border-bottom: 1px solid #eee;
    background-color: #fff;
}

.referrals-container {
    padding: 20px;
}

/* DataTable styling */
#patient-referrals-table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

#patient-referrals-table thead th {
    background-color: #ffffff;
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eaeaea;
    position: relative;
}

#patient-referrals-table thead th:after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.5;
}

#patient-referrals-table thead th:first-child:after {
    display: none;
}

#patient-referrals-table tbody tr {
    background-color: #fff;
    border-bottom: 1px solid #eaeaea;
}

#patient-referrals-table tbody tr:hover {
    background-color: #f8f9fa;
}

#patient-referrals-table td {
    padding: 15px 10px;
    vertical-align: middle;
}

/* Checkbox styling */
#patient-referrals-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

#patient-referrals-table input[type="checkbox"]:checked {
    background-color: #4a90e2;
    border-color: #4a90e2;
}

#patient-referrals-table input[type="checkbox"]:checked:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="%23fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

/* Table data styling */
#patient-referrals-table td:nth-child(2) {
    color: #333;
    font-weight: 500;
}

#patient-referrals-table td:nth-child(3),
#patient-referrals-table td:nth-child(4) {
    line-height: 1.5;
}

#patient-referrals-table td:last-child {
    text-align: center;
}

.patient-name {
    font-weight: 600;
    display: block;
    margin-bottom: 3px;
}

.patient-phone {
    color: #666;
}

.visit-reason {
    font-weight: 500;
}

.tooth-number {
    color: #4a90e2;
    font-weight: 600;
}

.comment-text {
    color: #555;
    line-height: 1.4;
}

/* Attachment styling */
.download-icon {
    fill: #4a90e2;
    vertical-align: middle;
    width: 20px;
    height: 20px;
}

a.download-attachments {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: transparent;
}

a.download-attachments:hover {
    opacity: 0.8;
}

.download-attachment-button {
    background-color: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f1f7ff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-attachment-button:hover {
    background-color: #e4f1fd;
}

.download-attachment-button svg {
    width: 18px;
    height: 18px;
    fill: #4a90e2;
}

.download-btn {
    background-color: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #4a90e2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-btn svg {
    fill: #4a90e2;
    width: 20px;
    height: 20px;
}

.attachment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #f1f7ff;
    border-radius: 50%;
}

.attachment-icon svg {
    width: 20px;
    height: 20px;
    fill: #4a90e2;
}

/* File badge styling */
.file-badge {
    display: inline-flex;
    align-items: center;
    background-color: #f1f7ff;
    border-radius: 12px;
    padding: 3px 10px 3px 3px;
    margin-left: 5px;
}

.file-badge-icon {
    background-color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
}

.file-badge-count {
    color: #4a90e2;
    font-size: 12px;
    font-weight: 600;
}

.attachment-count {
    background-color: #e4f1fd;
    color: #4a90e2;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
    margin-left: 5px;
}

/* ==================== ANIMATIONS ==================== */
@keyframes loadingDots {
    0%, 100% {
        opacity: 0.3;
        transform: translateY(-50%) scale(0.8);
    }
    40% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */
@media (min-width: 992px) {
    .checkbox-wrapper {
        width: calc(33.333% - 12px);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .checkbox-wrapper {
        width: calc(50% - 12px);
    }
}

@media (max-width: 768px) {
    .patient-referral-form-container {
        padding: 1.5rem;
        margin: 1rem auto;
    }
    
    .form-row .form-group {
        flex: 1 0 100%;
    }
    
    .form-actions {
        margin-top: 1.5rem;
    }
    
    .submit-button {
        width: 100%;
    }
    
    .checkbox-wrapper {
        width: 100%;
    }
    
    .radio-option-wrapper {
        margin-bottom: 15px;
    }
    
    .radio-options label {
        font-size: 16px;
    }
}

@media screen and (max-width: 992px) {
    #patient-referrals-table {
        display: block;
        overflow-x: auto;
    }
    
    .dataTables_filter input {
        width: 100%;
        max-width: 300px;
    }
}

/*additiona style, nmagbanua@adssys.digital*/
.form-group input[type="date"]
{
    width: 25% !important;
}
/*ends here*/