/* Add Student Modal Styles */

/* Modal Base */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 1.25rem;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Modal Header */
.modal-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    font-family: 'Outfit', sans-serif;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 0.625rem;
    border: none;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
    transform: scale(1.05);
}

/* Modal Body */
.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-input {
    padding: 0.75rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    color: #1e293b;
    background: white;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.form-input:hover {
    border-color: #cbd5e1;
}

.form-input:focus {
    outline: none;
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.form-input::placeholder {
    color: #94a3b8;
}

/* Photo Upload */
.photo-upload-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 0.875rem;
    border: 2px dashed #cbd5e1;
}

.photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 0.875rem;
    background: white;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-upload-actions {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    color: #1e293b;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}

.btn-upload:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn-remove-photo {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove-photo:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.upload-hint {
    font-size: 0.8125rem;
    color: #64748b;
}

/* Modal Footer */
.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
    background: #f8fafc;
}

.btn-secondary {
    padding: 0.75rem 1.75rem;
    background: white;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    color: white;
    border: none;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(217, 119, 6, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .modal {
        padding: 1rem;
    }

    .modal-content {
        max-height: 95vh;
        border-radius: 1rem;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .photo-upload-container {
        flex-direction: column;
        text-align: center;
    }

    .modal-footer {
        padding: 1.25rem 1.5rem;
        flex-direction: column;
    }

    .btn-secondary,
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* Success Notification Animation */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Form Hint Text */
.form-hint {
    font-size: 0.8125rem;
    color: #64748b;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Age display hint - calculated from date of birth */
#editAgeDisplay,
#studentAgeDisplay {
    display: block;
    margin-top: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 0.375rem;
    color: #166534;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Edit Bot Grid Styles */
.edit-bot-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.edit-bot-tier {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1rem;
}

.edit-bot-tier-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.edit-bot-tier-bots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.edit-bot-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.edit-bot-checkbox:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.edit-bot-checkbox.checked {
    border-color: #10b981;
    background: #ecfdf5;
}

.edit-bot-checkbox input[type="checkbox"] {
    display: none;
}

.edit-bot-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.edit-bot-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1e293b;
}

.edit-bot-rating {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.edit-bot-checkbox.checked .edit-bot-name {
    color: #059669;
}

.edit-bot-checkbox.checked .edit-bot-avatar::after {
    content: '✓';
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border-radius: 50%;
    font-size: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-bot-checkbox .edit-bot-avatar {
    position: relative;
}

/* Responsive for bot grid */
@media (max-width: 640px) {
    .edit-bot-tier-bots {
        flex-direction: column;
    }

    .edit-bot-checkbox {
        width: 100%;
    }
}

/* ==================== Avatar Lightbox ==================== */

.avatar-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.avatar-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.avatar-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.avatar-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-lightbox.active .avatar-lightbox-content {
    transform: scale(1);
}

.avatar-lightbox-image {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 1rem;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.avatar-lightbox-initials {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.avatar-lightbox-initials.coach-avatar {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}

.avatar-lightbox-initials.student-avatar {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.avatar-lightbox-close {
    position: absolute;
    top: -50px;
    right: -10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.avatar-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.avatar-lightbox-name {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Clickable avatar styling */
.avatar-clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.avatar-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.avatar-clickable:active {
    transform: scale(0.98);
}

/* Hint icon on avatar hover */
.avatar-wrapper.clickable {
    position: relative;
    cursor: pointer;
}

.avatar-wrapper.clickable::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M10 14 21 3'/%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px;
}

.avatar-wrapper.clickable:hover::after {
    opacity: 1;
    transform: scale(1);
}

@media (max-width: 768px) {
    .avatar-lightbox-image {
        max-width: 95vw;
        max-height: 70vh;
        border-radius: 0.75rem;
    }

    .avatar-lightbox-initials {
        width: 200px;
        height: 200px;
        font-size: 4rem;
    }

    .avatar-lightbox-close {
        top: -45px;
        right: 0;
    }

    .avatar-lightbox-name {
        bottom: -50px;
        font-size: 1rem;
    }
}
