/**
 * UI Components for ExamHub Theme
 * Consolidated modal, notification, and other UI components
 */

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e1e5e9;
}

.modal-title {
    margin: 0;
    color: #1a1a1a;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    pointer-events: none;
}

.notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 1rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    pointer-events: auto;
    overflow: hidden;
    border-left: 4px solid #007cba;
}

.notification.show {
    transform: translateX(0);
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem 0.5rem;
}

.notification-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.notification-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.notification-message {
    padding: 0 1.5rem 1rem;
    line-height: 1.4;
    font-size: 0.9rem;
    color: #666;
}

/* Notification Types */
.notification-success {
    border-left-color: #28a745;
}

.notification-success .notification-icon {
    color: #28a745;
}

.notification-error {
    border-left-color: #dc3545;
}

.notification-error .notification-icon {
    color: #dc3545;
}

.notification-warning {
    border-left-color: #ffc107;
}

.notification-warning .notification-icon {
    color: #ffc107;
}

.notification-info {
    border-left-color: #17a2b8;
}

.notification-info .notification-icon {
    color: #17a2b8;
}

/* Loading Components */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    text-align: center;
    color: #666;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar */
.progress {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #4facfe);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    color: white;
    background: #6c757d;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary { background: #007cba; }
.badge-secondary { background: #6c757d; }
.badge-success { background: #28a745; }
.badge-warning { background: #ffc107; color: #212529; }
.badge-danger { background: #dc3545; }
.badge-info { background: #17a2b8; }

.badge-outline {
    background: transparent;
    border: 1px solid currentColor;
}

.badge-pill {
    border-radius: 12px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e1e5e9;
}

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

.card-header {
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
}

.card-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    color: #666;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.alert-message {
    margin: 0;
    line-height: 1.5;
}

.alert-dismissible {
    padding-right: 3rem;
    position: relative;
}

.alert-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

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

/* Alert Types */
.alert-primary {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.alert-secondary {
    background: #e2e3e5;
    border-color: #d6d8db;
    color: #383d41;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* Tooltips */
.tooltip {
    position: absolute;
    z-index: 1000;
    padding: 0.5rem 0.75rem;
    background: #333;
    color: white;
    font-size: 0.875rem;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tooltip.show {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Dropdown Menus */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    padding: 0.5rem 0;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #f8f9fa;
    color: #007cba;
    text-decoration: none;
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid #e9ecef;
}

/* Pagination */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.25rem;
    justify-content: center;
}

.pagination li {
    margin: 0;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: #007cba;
    border-color: #007cba;
    color: white;
    text-decoration: none;
}

.pagination .current a,
.pagination .current span {
    background: #007cba;
    border-color: #007cba;
    color: white;
}

.pagination .disabled a,
.pagination .disabled span {
    color: #6c757d;
    pointer-events: none;
    background: #fff;
    border-color: #dee2e6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        max-width: none;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .notification-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification {
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: 1rem;
    }
    
    .pagination a,
    .pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.75rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: 0.75rem;
    }
    
    .alert {
        padding: 0.75rem;
    }
}

/* Print Styles */
@media print {
    .modal-overlay,
    .notification-container,
    .loading-screen {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
}
