/**
 * Doctors Portal Patient Management Styles
 */

/* Responsive Dashboard Layout */
.doctors-portal-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Patients Tab Navigation */
.patients-tabs {
    margin-bottom: 20px;
}

.patients-tabs-nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    border-bottom: 1px solid #ddd;
}

.patients-tabs-nav li {
    margin: 0;
    padding: 0;
}

.patients-tabs-nav a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #666;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    margin-right: 5px;
    border-radius: 5px 5px 0 0;
    transition: all 0.2s ease;
}

.patients-tabs-nav a:hover {
    background-color: #e9e9e9;
    color: #333;
}

.patients-tabs-nav li.active a {
    background-color: #fff;
    color: #333;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
}

.patients-tab-content {
    display: none;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
    transition: opacity 0.3s ease;
}

.patients-tab-content.active {
    display: block;
}

/* Patient Search and Filter */
.patient-search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-direction:column;
}

.patient-search {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.patient-filter {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    min-width: 120px;
}

/* Patient List */
.patients-list {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.patient-item {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.patient-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.patient-name {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.2rem;
}

.patient-meta {
    margin-bottom: 10px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.patient-meta span {
    background-color: #eee;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.patient-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.patient-actions a {
    display: inline-block;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    text-align: center;
    font-weight: 500;
}

.patient-actions a:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.patient-actions .view-patient {
    background-color: #4a6baf;
    color: #fff;
}

.patient-actions .edit-patient {
    background-color: #4caf50;
    color: #fff;
}

.patient-actions .delete-patient {
    background-color: #f44336;
    color: #fff;
}

/* Patient Share Container */
.patient-share-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.patient-share-link {
    margin-bottom: 10px;
}

.patient-link-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 8px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-button {
    display: inline-block;
    padding: 6px 10px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    background-color: #4a6baf;
    color: white;
    transition: all 0.2s ease;
}

.share-button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.share-button.whatsapp {
    background-color: #25D366;
}

.share-button.email {
    background-color: #D44638;
}

.share-button.sms {
    background-color: #5BC236;
}

/* Patient Details */
.patient-details {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
}

.patient-detail-row {
    margin-bottom: 15px;
    line-height: 1.5;
}

.patient-detail-row strong {
    display: inline-block;
    min-width: 150px;
    font-weight: 600;
}

.treatment-plan {
    margin-top: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 3px solid #4a6baf;
}

/* Improved Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4a6baf;
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    color: #555;
    font-size: 1rem;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal Improvements */
.doctors-portal-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: #fff;
    margin: 30px auto;
    padding: 25px;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

/* Specific styling for edit patient modal */
#edit-patient-modal .modal-content {
    padding-top: 50px; /* Extra space at top for close button */
}

#edit-patient-modal form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

#edit-patient-modal .form-group {
    margin-bottom: 0;
}

#edit-patient-modal .form-group:nth-child(5),
#edit-patient-modal .form-group:nth-child(9),
#edit-patient-modal h4,
#edit-patient-modal .form-group:last-child {
    grid-column: 1 / -1;
}

#edit-patient-modal textarea {
    min-height: 120px;
}

#edit-patient-modal .form-group:last-child {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border-radius: 50%;
    z-index: 10;
}

.modal-close:hover {
    color: #333;
    background-color: #e0e0e0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Form Improvements */
.doctors-portal-form .form-group {
    margin-bottom: 20px;
}

.doctors-portal-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.doctors-portal-form input[type="text"],
.doctors-portal-form input[type="number"],
.doctors-portal-form input[type="password"],
.doctors-portal-form select,
.doctors-portal-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.doctors-portal-form input:focus,
.doctors-portal-form select:focus,
.doctors-portal-form textarea:focus {
    border-color: #4a6baf;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 107, 175, 0.1);
}

.doctors-portal-form .field-note {
    font-size: 13px;
    color: #777;
    margin-top: 5px;
}

.doctors-portal-button {
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    background-color: #4a6baf;
    color: white;
}

.doctors-portal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: #3d5a94;
}

.doctors-portal-button.delete {
    background-color: #f44336;
}

.doctors-portal-button.delete:hover {
    background-color: #d32f2f;
}

.doctors-portal-button.cancel {
    background-color: #999;
}

.doctors-portal-button.cancel:hover {
    background-color: #777;
}

/* Form Validation */
.input-error {
    border-color: #f44336 !important;
}

.form-error {
    color: #f44336;
    font-size: 13px;
    margin-top: 5px;
    display: block;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    animation: toastFadeIn 0.3s ease;
    max-width: 350px;
}

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

.toast-success {
    background-color: #4caf50;
}

.toast-error {
    background-color: #f44336;
}

.toast-info {
    background-color: #2196F3;
}

.toast-close {
    margin-left: 10px;
    cursor: pointer;
    opacity: 0.7;
}

.toast-close:hover {
    opacity: 1;
}

/* Patient QR Code */
.patient-qr {
    margin-top: 15px;
    text-align: center;
}

/* Response Messages */
#patient-response.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

#patient-response.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    display: none; /* Hide the toggle button but keep functionality */
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

.dark-mode-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.dark-mode-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.light-mode-icon {
    display: block;
}

.dark-mode-icon {
    display: none;
}

.dark-mode .light-mode-icon {
    display: none;
}

.dark-mode .dark-mode-icon {
    display: block;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .tabs-nav {
        flex-wrap: wrap;
    }
    
    .tabs-nav li {
        flex: 1 1 50%;
        margin-bottom: 5px;
    }
    
    .patient-actions {
        flex-direction: column;
    }
    
    .patients-list {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 90%;
        margin: 10px;
    }
}

/* Dark Mode Support */
.dark-mode .doctors-portal-dashboard {
    background-color: #222;
    color: #eee;
}

.dark-mode .patient-item {
    background-color: #333;
    border-color: #444;
}

.dark-mode .patient-name {
    color: #fff;
}

.dark-mode .patient-meta span {
    background-color: #444;
    color: #eee;
}

.dark-mode .modal-content {
    background-color: #333;
    color: #eee;
}

.dark-mode .doctors-portal-form input,
.dark-mode .doctors-portal-form select,
.dark-mode .doctors-portal-form textarea {
    background-color: #444;
    border-color: #555;
    color: #eee;
}

.dark-mode .tab-content {
    background-color: #333;
    border-color: #444;
}

.dark-mode .tabs-nav a {
    background-color: #444;
    border-color: #555;
    color: #eee;
}

.dark-mode .tabs-nav li.active a {
    background-color: #333;
    border-bottom-color: #333;
}
