/**
 * Admin Common Styles
 * Shared CSS for Additional Teachers Module and other admin forms
 * Created: August 2025
 */

/* ============================================
   SIDEBAR MENU ENHANCEMENTS
   ============================================ */

/* Active menu item styling */
.nav-sidebar .nav-item > .nav-link.active,
.nav-sidebar .nav-item.menu-open > .nav-link {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #c2c7d0 !important;
}

.nav-sidebar .nav-item > .nav-link.active {
    background-color: #007bff !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    border-radius: 0.25rem;
    margin: 2px 8px;
}

.nav-sidebar .nav-item > .nav-link.active .nav-icon {
    color: #fff !important;
}

/* Submenu active states */
.nav-sidebar .nav-treeview .nav-item > .nav-link.active {
    background-color: rgba(0, 123, 255, 0.2) !important;
    color: #007bff !important;
    font-weight: 600;
    border-left: 3px solid #007bff;
    margin-left: 8px;
    padding-left: 1rem;
}

.nav-sidebar .nav-treeview .nav-item > .nav-link.active .nav-icon {
    color: #007bff !important;
}

/* Hover effects for menu items */
.nav-sidebar .nav-item > .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    transition: all 0.3s ease;
}

.nav-sidebar .nav-item > .nav-link:hover:not(.active) {
    transform: translateX(2px);
}

/* Menu animation */
.nav-sidebar .nav-item {
    transition: all 0.3s ease;
}

/* Badge styling in menu */
.nav-sidebar .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* ============================================
   CHECKBOX STYLING (iCheck Replacement)
   ============================================ */

.icheck-primary input[type="checkbox"] {
    opacity: 0;
    position: absolute;
}

.icheck-primary label {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
}

.icheck-primary input[type="checkbox"]:checked + label {
    background: #007bff;
    border-color: #007bff;
}

.icheck-primary input[type="checkbox"]:checked + label:after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
}

/* ============================================
   AVATAR CIRCLES
   ============================================ */

.avatar-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #007bff, #6f42c1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

/* ============================================
   BADGE ENHANCEMENTS
   ============================================ */

.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

.badge-pink {
    color: #fff;
    background-color: #e83e8c;
}

/* ============================================
   BUTTON GROUP ENHANCEMENTS
   ============================================ */

.btn-group .btn {
    margin-right: 2px;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

.btn-group-vertical .btn {
    margin-bottom: 2px;
}

.btn-xs {
    padding: 0.1rem 0.3rem;
    font-size: 0.7rem;
    line-height: 1.2;
    border-radius: 0.2rem;
}

/* ============================================
   EMPTY STATE STYLING
   ============================================ */

.empty-state {
    padding: 3rem 2rem;
}

/* ============================================
   TABLE ENHANCEMENTS
   ============================================ */

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(0,123,255,0.05);
}

/* ============================================
   FIXED VIEWPORT LAYOUT
   ============================================ */

/* Fixed viewport layout - content area same height as sidebar */
body {
    height: 100vh;
    overflow: hidden;
}

.wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    flex-shrink: 0;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - 57px); /* Subtract navbar height */
}

.content-header {
    flex-shrink: 0;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    margin: 0;
}

.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.container-fluid {
    padding: 15px;
    min-height: 100%;
}

/* ============================================
   CARD ENHANCEMENTS
   ============================================ */

/* Enhanced AdminLTE card styling */
.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    border: none !important;
    border-radius: 0.5rem !important;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    transform: translateY(-2px);
}

.card-header {
    font-weight: 600 !important;
    border-bottom: 1px solid #dee2e6 !important;
    border-radius: 0.5rem 0.5rem 0 0 !important;
    padding: 1rem 1.25rem;
}

/* Card Outline Styles */
.card-outline.card-primary {
    border-top: 3px solid #007bff !important;
}

.card-outline .card-header {
    background: #fff !important;
    border-bottom: 1px solid #dee2e6 !important;
}

.card-outline .card-header .card-title {
    font-weight: 600 !important;
}

/* Card Header Color Themes */
.card-primary .card-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}

.card-info .card-header {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%) !important;
    color: white !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}

.card-warning .card-header {
    background: linear-gradient(135deg, #ffc107 0%, #d39e00 100%) !important;
    color: #212529 !important;
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
}

.card-success .card-header {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
    color: white !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}

.card-dark .card-header {
    background: linear-gradient(135deg, #343a40 0%, #1d2124 100%) !important;
    color: white !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}

.card-secondary .card-header {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%) !important;
    color: white !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}

.card-danger .card-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: white !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
}

/* ============================================
   FORM ENHANCEMENTS
   ============================================ */

.form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control {
    border-radius: 0.375rem !important;
    border: 1px solid #ced4da !important;
    transition: all 0.3s ease;
    padding: 0.5rem 0.75rem;
}

.form-control:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
    transform: translateY(-1px);
}

.form-control.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.form-control.is-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.invalid-feedback {
    font-size: 0.875rem;
    color: #dc3545;
    font-weight: 500;
}

.valid-feedback {
    font-size: 0.875rem;
    color: #28a745;
    font-weight: 500;
}

/* ============================================
   BUTTON ENHANCEMENTS
   ============================================ */

.btn {
    border-radius: 0.375rem !important;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0.5rem 1rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%) !important;
    color: white !important;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
    color: white !important;
}

.btn-success:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%) !important;
    color: white !important;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: white !important;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%) !important;
    color: white !important;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #d39e00 100%) !important;
    color: #212529 !important;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d39e00 0%, #b8860b 100%) !important;
    color: #212529 !important;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%) !important;
    color: white !important;
}

.btn-info:hover {
    background: linear-gradient(135deg, #117a8b 0%, #0c5460 100%) !important;
    color: white !important;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%) !important;
    color: white !important;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #545b62 0%, #383d41 100%) !important;
    color: white !important;
}

.btn-dark {
    background: linear-gradient(135deg, #343a40 0%, #1d2124 100%) !important;
    color: white !important;
}

.btn-dark:hover {
    background: linear-gradient(135deg, #1d2124 0%, #101214 100%) !important;
    color: white !important;
}

/* Loading state for buttons */
.btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

.content::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ============================================
   ALERT ENHANCEMENTS
   ============================================ */

.alert {
    border-radius: 0.5rem !important;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.alert-dismissible .close {
    font-weight: 700;
    opacity: 0.7;
}

.alert-dismissible .close:hover {
    opacity: 1;
}

/* ============================================
   FILE UPLOAD ENHANCEMENTS
   ============================================ */

.file-info {
    border-radius: 0.375rem;
    border: 1px dashed #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.file-info small {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Document card styling */
.document-card {
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.document-card:hover {
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.05);
}

.document-card.has-file {
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.05);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 767.98px) {
    .content-wrapper {
        height: calc(100vh - 57px);
    }
    
    .container-fluid {
        padding: 10px;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        margin-bottom: 0.5rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .small-box .inner h3 {
        font-size: 1.5rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .avatar-circle {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

@media (max-width: 575.98px) {
    .container-fluid {
        padding: 5px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-group .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn-group {
        width: 100%;
        justify-content: center;
    }
    
    .small-box .inner h3 {
        font-size: 1.2rem;
    }
    
    .small-box .inner p {
        font-size: 0.9rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.shadow-lg-hover:hover {
    box-shadow: 0 1rem 3rem rgba(0,0,0,.175) !important;
}

.text-gradient-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-gradient-primary {
    border: 2px solid;
    border-image: linear-gradient(135deg, #007bff 0%, #0056b3 100%) 1;
}

.animate-bounce-subtle {
    animation: bounce-subtle 0.6s ease-in-out;
}

@keyframes bounce-subtle {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* ============================================
   TIMELINE ENHANCEMENTS
   ============================================ */

.timeline {
    position: relative;
    margin: 0 0 30px 0;
}

.timeline-item {
    transition: all 0.3s ease;
    opacity: 0.9;
}

.timeline-item:hover {
    opacity: 1;
    transform: translateX(5px);
}

.timeline-item.animate__fadeInUp {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   BADGE ENHANCEMENTS
   ============================================ */

.badge {
    font-weight: 600;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.05);
}

.badge.animate__bounce {
    animation: bounce 0.6s ease-in-out;
}

/* ============================================
   LOADING STATES
   ============================================ */

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .btn,
    .card-header,
    .sidebar,
    .main-header,
    .content-header {
        display: none !important;
    }
    
    .content-wrapper,
    .content {
        height: auto !important;
        overflow: visible !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
        break-inside: avoid;
    }
}
