/* ============================================
   MODAL POPUP SYSTEM
   Campus Management System
   ============================================ */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.7) translateY(-50px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.modal-overlay.show .modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    flex-shrink: 0;
}

.modal-title-section {
    flex: 1;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #1a1a1a;
}

.modal-subtitle {
    font-size: 13px;
    color: #666;
    margin: 0;
}

/* Modal Body */
.modal-body {
    padding: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-message {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.modal-btn-primary {
    background: linear-gradient(135deg, #6834ad 0%, #8b5cf6 100%);
    color: white;
}

.modal-btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.modal-btn-secondary:hover {
    background: #e5e7eb;
}

/* ============================================
   SUCCESS MODAL STYLE
   ============================================ */
.modal-container.success .modal-header {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.modal-container.success .modal-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.modal-container.success .modal-title {
    color: #059669;
}

.modal-container.success .modal-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* ============================================
   ERROR MODAL STYLE
   ============================================ */
.modal-container.error .modal-header {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.modal-container.error .modal-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    animation: shake 0.5s;
}

.modal-container.error .modal-title {
    color: #dc2626;
}

.modal-container.error .modal-btn-primary {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ============================================
   WARNING MODAL STYLE
   ============================================ */
.modal-container.warning .modal-header {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.modal-container.warning .modal-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.modal-container.warning .modal-title {
    color: #d97706;
}

.modal-container.warning .modal-btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ============================================
   INFO MODAL STYLE
   ============================================ */
.modal-container.info .modal-header {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.modal-container.info .modal-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.modal-container.info .modal-title {
    color: #2563eb;
}

.modal-container.info .modal-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ============================================
   CONFIRM MODAL STYLE
   ============================================ */
.modal-container.confirm .modal-header {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.modal-container.confirm .modal-icon {
    background: linear-gradient(135deg, #6834ad 0%, #8b5cf6 100%);
    color: white;
}

.modal-container.confirm .modal-title {
    color: #6834ad;
}

.modal-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.modal-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.7) translateY(-50px);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-width: none;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.modal-container:focus {
    outline: 2px solid #6834ad;
    outline-offset: 2px;
}

.modal-btn:focus-visible {
    outline: 2px solid #6834ad;
    outline-offset: 2px;
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

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

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

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

/* ============================================
   INPUT MODAL STYLES
   ============================================ */
.modal-input-group {
    margin-bottom: 20px;
}

.modal-input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

.modal-input:focus {
    outline: none;
    border-color: #6834ad;
    box-shadow: 0 0 0 3px rgba(104, 52, 173, 0.1);
}

.modal-textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-input-error {
    border-color: #ef4444;
}

.modal-input-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.modal-error-message {
    color: #ef4444;
    font-size: 13px;
    margin-top: 5px;
}

/* ============================================
   LOADING/EMAIL LOADING MODAL STYLE
   ============================================ */
.email-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    backdrop-filter: blur(3px);
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.email-loading-card {
    width: min(420px, 100%);
    border-radius: 14px;
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
    padding: 26px 22px;
    text-align: center;
}

.email-loading-card h3 {
    margin: 12px 0 8px 0;
    font-size: 20px;
    color: #1f2937;
    font-weight: 600;
}

.email-loading-card p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.55;
}

.email-loading-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border-radius: 999px;
    border: 5px solid #ede9fe;
    border-top-color: #6834ad;
    animation: email-spin 0.85s linear infinite;
}

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