/* static/css/profile.css */
:root {
    --primary-color: #4CAF50;
    --primary-color-rgb: 76, 175, 80;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --body-bg: #f4f7f6;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--body-bg);
    margin: 0;
    padding: 0;
    color: #333;
}

.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styling to match project page */
.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.projects-header h1 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    gap: 8px;
}

.button i {
    margin-right: 4px;
}

/* Button variations */
.button.profile-link {
    color: white;
}

.button.logout-button {
    background-color: var(--danger-color);
    color: white;
}

.button.edit-button, 
.button.save-button {
    background-color: var(--primary-color);
    color: white;
}

.button.cancel-button {
    background-color: var(--secondary-color);
    color: white;
}

.button.request-guide-btn,
.button.add-student-btn {
    background-color: var(--primary-color);
    color: white;
    margin-top: 15px;
}

.button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Profile content styling */
.profile-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.profile-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.profile-photo-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.profile-photo-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    overflow: hidden;
}

#profilePhoto {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-initials {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: #6c757d;
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
}

.no-photo .profile-initials {
    display: flex;
}

.photo-upload-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-upload-btn:hover {
    background-color: #3d8b40;
}

.profile-info {
    flex-grow: 1;
}

.profile-info h1 {
    margin: 0 0 5px 0;
    font-size: 24px;
}

.profile-info .email {
    color: #666;
    margin: 5px 0;
}

.profile-info .role {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    margin-top: 5px;
}

.business-card {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-width: 200px;
}

.business-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
    color: #333;
}

.business-card p {
    margin: 5px 0;
    color: #666;
}

.card-institute, .card-location {
    font-style: italic;
}

/* Tab-style navigation */
.category-selector {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.category-selector span {
    font-weight: 500;
    color: #555;
}

.category-options {
    display: flex;
    gap: 10px;
}

.category-btn {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 20px;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Style for editable tabs in edit mode */
.category-btn.editable-tab {
    position: relative;
    border: 2px solid var(--primary-color);
    background-color: rgba(var(--primary-color-rgb), 0.1);
    font-weight: bold;
}

/* Add a pencil icon to indicate editable tabs */
.category-btn.editable-tab::after {
    content: '✏️';
    display: inline-block;
    margin-left: 5px;
    font-size: 12px;
}

.category-btn.editable-tab.active {
    background-color: var(--primary-color);
    color: white;
}

.category-btn:hover:not(.active) {
    background-color: #e0e0e0;
}

/* Form styling */
.profile-form {
    transition: opacity 0.3s ease;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    min-width: 250px;
    margin-bottom: 20px;
}

/* Make salutation field take up less space */
.form-group:has(#salutation),
.form-group.salutation-group {
    flex: 0 0 150px;
    min-width: 150px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.profile-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border 0.3s ease;
}

.profile-field:focus {
    border-color: var(--primary-color);
    outline: none;
}

textarea.profile-field {
    resize: vertical;
}

.view-value {
    display: block;
    padding: 10px 0;
    color: #333;
}

.view-bio {
    white-space: pre-line;
    color: #555;
    line-height: 1.5;
}

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

/* Guide/Student relationship styling */
.guides-container, .students-container {
    margin-top: 20px;
}

.guides-container h3, .students-container h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.guide-info, .student-info {
    padding: 15px;
    border-radius: var(--border-radius);
    background-color: #f9f9f9;
    border: 1px solid #eee;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.guide-info:hover, .student-info:hover {
    box-shadow: var(--shadow);
    border-color: #ddd;
}

.guides-list, .students-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.primary-guide {
    border-left: 4px solid var(--primary-color);
}

.guide-info .guide-name, .student-info .student-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.guide-info .guide-role, .student-info .student-program {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.guide-info .guide-email, .student-info .student-email {
    font-size: 14px;
    color: #555;
}

.relationship-status {
    display: inline-block;
    font-size: 12px;
    border-radius: 12px;
    padding: 3px 8px;
    margin-top: 5px;
}

.status-pending {
    background-color: #ffeeba;
    color: #856404;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 95%;
    max-width: 650px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.search-container {
    display: flex;
    margin-bottom: 20px;
}

.search-container input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.search-container button {
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.guides-search-results {
    max-height: 300px;
    overflow-y: auto;
}

/* Edit mode toggle */
/* Only hide profile fields in personal and academic tabs during view mode */
.profile-view-mode #personal-tab .profile-field,
.profile-view-mode #academic-tab .profile-field {
    display: none;
}

.profile-view-mode .view-value {
    display: block;
}

.profile-view-mode .form-actions {
    display: none;
}

/* Show relevant fields in edit mode */
.profile-edit-mode #personal-tab .profile-field,
.profile-edit-mode #academic-tab .profile-field {
    display: block;
}

/* Always hide view values in edit mode */
.profile-edit-mode .view-value {
    display: none;
}

.profile-edit-mode .form-actions {
    display: flex;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .projects-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group {
        min-width: auto;
    }
    
    .guides-list, .students-list {
        grid-template-columns: 1fr;
    }
    
    .business-card {
        width: 100%;
    }
    
    .modal-content {
        width: 90%;
        padding: 15px;
    }
}

/* Business Card Styling for Guide & Student Cards */
.business-card-wrapper {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 15px;
}

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

.business-card-wrapper.primary-guide {
    border: none;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.business-card-content {
    display: flex;
    flex-direction: column;
}

.card-gradient-bar {
    height: 5px;
    background: linear-gradient(to right, var(--primary-color), #83c585);
}

.card-gradient-bar.status-active {
    background: linear-gradient(to right, #28a745, #5cb85c);
}

.card-gradient-bar.status-pending {
    background: linear-gradient(to right, #ffc107, #ffdb58);
}

.card-gradient-bar.status-rejected, 
.card-gradient-bar.status-inactive {
    background: linear-gradient(to right, #dc3545, #f08080);
}

.business-card-layout {
    display: flex;
    padding: 15px;
}

.business-card-photo {
    flex: 0 0 80px;
    position: relative;
}

.business-card-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #555;
    background-size: cover;
    background-position: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.primary-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.business-card-details {
    flex: 1;
    margin-left: 15px;
    display: flex;
    flex-direction: column;
}

.business-card-name {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.business-card-name a {
    color: inherit;
    text-decoration: none;
}

.business-card-name a:hover {
    text-decoration: underline;
}

.business-card-title {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 8px;
}

.business-card-wrapper .relationship-status {
    display: inline-block;
    font-size: 0.75rem;
    border-radius: 12px;
    padding: 3px 8px;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.business-card-contact {
    margin: 10px 0;
}

.business-card-contact p {
    margin: 5px 0;
    color: #666;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.card-icon {
    margin-right: 8px;
    color: #888;
    width: 15px;
    text-align: center;
}

.card-actions {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card-actions .button {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.approve-btn {
    background-color: #28a745;
    color: white;
}

.reject-btn {
    background-color: #dc3545;
    color: white;
}

/* Make business cards responsive */
@media (max-width: 500px) {
    .business-card-layout {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .business-card-details {
        margin-left: 0;
        margin-top: 15px;
        align-items: center;
    }
    
    .card-actions {
        justify-content: center;
    }
}

/* Business Card Grid Layout */
.business-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.primary-guide-container {
    margin-bottom: 25px;
}

/* On small screens, reduce to single column */
@media (max-width: 768px) {
    .business-card-grid {
        grid-template-columns: 1fr;
    }
}

/* Profile Business Card Styling */
.profile-business-card {
    width: 300px;
    margin: 0;
    transition: transform 0.3s ease, opacity 0.3s ease, max-height 0.5s ease, margin 0.5s ease;
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
}

.profile-business-card.card-hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    border: none;
}

.profile-business-card:hover {
    transform: scale(1.03);
}

.profile-business-card .card-gradient-bar {
    background: linear-gradient(to right, #4a6bdf, #45a7f6);
}

.toggle-card-btn {
    margin-top: 10px;
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
    padding: 5px 10px;
    font-size: 0.9rem;
}

.toggle-card-btn:hover {
    background-color: #e0e0e0;
}

.profile-header {
    flex-wrap: wrap;
    gap: 20px;
}

.profile-header .business-card-wrapper {
    margin-top: 10px;
    margin-bottom: 0;
}

/* Responsive adjustments for profile header */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
    }
    
    .profile-business-card {
        width: 100%;
        max-width: 400px;
    }
    
    .profile-header .profile-photo-container {
        margin: 0 auto;
    }
    
    .profile-header .profile-info {
        text-align: center;
        width: 100%;
    }
}

.roll-number {
    display: inline-block;
    margin-left: 5px;
    color: #777;
    font-size: 0.9em;
}

/* Security Tab Styles */
.security-section,
.login-history-section {
    margin-bottom: 2rem;
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.security-section h3,
.login-history-section h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #333;
    font-size: 1.2rem;
}

.password-requirements {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
}

.password-requirements p {
    margin-top: 0;
    font-weight: 600;
    color: #666;
}

.password-requirements ul {
    margin: 0.5rem 0 0 1.2rem;
    padding: 0;
}

.password-requirements li {
    margin-bottom: 0.25rem;
    color: #666;
}

#changePasswordBtn {
    margin-top: 1rem;
}

/* Login History Table Styles */
.login-history-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.login-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.login-history-table th {
    background-color: #f1f1f1;
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
}

.login-history-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
}

.login-history-table tr:hover {
    background-color: #f9f9f9;
}

.login-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
}

.login-status.success {
    background-color: #d4edda;
    color: #155724;
}

.login-status.failed {
    background-color: #f8d7da;
    color: #721c24;
}

.loading-message,
.no-data-message,
.error-message {
    text-align: center;
    padding: 1.5rem;
    color: #666;
    font-style: italic;
}

.error-message {
    color: #721c24;
}

@media (max-width: 768px) {
    .login-history-table th,
    .login-history-table td {
        padding: 0.5rem;
    }
}

/* Ensure form fields within modal use consistent styling */
.modal-content .form-group {
    margin-bottom: 15px;
}

.modal-content .profile-field {
    display: block;
    width: 100%;
}

/* Style form actions specifically within modal */
.modal-content .form-actions {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

/* Ensure the submit button is clearly visible */
.modal-content .form-actions .button {
    padding: 10px 20px;
    font-size: 1rem;
}

.modal-content .form-actions .save-button {
} 