/*
|--------------------------------------------------------------------------
| AdminLTE Custom Styles - Overall Site Improvements
|--------------------------------------------------------------------------
|
| Comprehensive styling improvements for the entire application
|
*/

/* ============================================
   Global Improvements
   ============================================ */

/* Smooth transitions for all interactive elements */
* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ============================================
   Cards - Enhanced Design
   ============================================ */

.card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    padding: 1rem 1.25rem;
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #495057;
}

.card-title i {
    margin-right: 8px;
    color: #007bff;
}

/* ============================================
   Buttons - Enhanced Styling
   ============================================ */

.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.875rem;
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ============================================
   Tables - Enhanced Design & Responsive
   ============================================ */

/* Make all tables responsive by default */
.table {
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    min-width: 600px; /* Minimum width for proper display */
}

/* Ensure table-responsive wrapper works properly */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

.table-responsive > .table {
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem 0.75rem;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #f0f0f0;
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered thead th {
    border: 1px solid #dee2e6;
}

.table-bordered tbody td {
    border: 1px solid #e9ecef;
}

/* ============================================
   Small Box (Statistics Cards) - Responsive
   ============================================ */

.small-box {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.small-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.small-box .inner {
    padding: 1.5rem;
    flex: 1;
}

.small-box .inner h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.small-box .inner p {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.4;
}

.small-box .icon {
    transition: all 0.3s ease;
    opacity: 0.15;
    font-size: 70px;
    position: absolute;
    right: 15px;
    top: 15px;
    z-index: 0;
}

.small-box:hover .icon {
    opacity: 0.2;
    transform: scale(1.1);
}

.small-box .small-box-footer {
    position: relative;
    text-align: center;
    padding: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    display: block;
    z-index: 10;
    background: rgba(0, 0, 0, 0.1);
    text-decoration: none;
    transition: all 0.3s ease;
}

.small-box .small-box-footer:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
}

/* Responsive adjustments for small boxes */
@media (max-width: 575.98px) {
    .small-box {
        margin-bottom: 1rem !important;
    }
    
    .small-box .inner {
        padding: 1rem;
        min-height: auto;
    }
    
    .small-box .inner h3 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .small-box .inner p {
        font-size: 0.875rem;
        margin-top: 0.5rem;
    }
    
    .small-box .icon {
        font-size: 45px;
        right: 10px;
        top: 10px;
    }
    
    .small-box .small-box-footer {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Stack cards vertically on mobile */
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .small-box .inner {
        padding: 1.25rem;
    }
    
    .small-box .inner h3 {
        font-size: 2rem;
    }
    
    .small-box .inner p {
        font-size: 0.9rem;
    }
    
    .small-box .icon {
        font-size: 55px;
        right: 12px;
        top: 12px;
    }
    
    .small-box .small-box-footer {
        padding: 0.65rem;
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .small-box .inner h3 {
        font-size: 2.25rem;
    }
    
    .small-box .icon {
        font-size: 60px;
    }
}

@media (min-width: 992px) {
    .small-box .inner h3 {
        font-size: 2.5rem;
    }
    
    .small-box .icon {
        font-size: 70px;
    }
}

/* Ensure cards have equal height in rows - only on larger screens */
@media (min-width: 576px) {
    .row > [class*="col-"] {
        display: flex;
        flex-direction: column;
    }
    
    .row > [class*="col-"] > .small-box {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

/* Fix for small-box positioning */
.small-box {
    position: relative;
    overflow: hidden;
}

.small-box .inner {
    position: relative;
    z-index: 1;
}

/* Prevent text overflow on small screens */
.small-box .inner h3 {
    word-break: break-word;
    hyphens: auto;
}

@media (max-width: 575.98px) {
    .small-box .inner h3 {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* ============================================
   Forms - Enhanced Styling
   ============================================ */

.form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 0.6rem 0.85rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: #adb5bd;
    font-style: italic;
}

.form-group label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-group label .text-danger {
    color: #dc3545 !important;
    font-weight: 600;
}

.custom-file-label {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 0.6rem 0.85rem;
    transition: all 0.3s ease;
}

.custom-file-input:focus ~ .custom-file-label {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
}

/* ============================================
   Badges - Enhanced Design
   ============================================ */

.badge {
    padding: 0.4rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge i {
    margin-right: 4px;
}

/* ============================================
   Toast Notifications - Enhanced
   ============================================ */

.toast {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
}

.toast-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.toast-header i {
    margin-right: 8px;
    font-size: 1.1rem;
}

.toast-body {
    padding: 1rem;
    font-size: 0.95rem;
}

/* ============================================
   Empty States
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: #495057;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* ============================================
   Search & Filter - Enhanced
   ============================================ */

.input-group {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.input-group .form-control {
    border-radius: 0;
    border: none;
}

.input-group .form-control:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.input-group-append .btn {
    border-radius: 0;
    box-shadow: none;
}

.input-group-append .btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* ============================================
   Pagination - Enhanced
   ============================================ */

.pagination-wrapper {
    width: 100%;
    padding: 0.75rem 0.25rem;
}

.pagination-wrapper .pagination-info {
    font-size: 0.875rem;
}

.pagination {
    margin-top: 0;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    color: #007bff;
    min-width: 38px;
    text-align: center;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background-color: #007bff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
}

.card-footer .pagination-wrapper,
.card-body .pagination-wrapper {
    margin-top: 0;
}

/* ============================================
   Alerts - Enhanced (for info messages)
   ============================================ */

.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.25rem;
}

.alert i {
    margin-right: 8px;
}

/* ============================================
   Modals - Enhanced
   ============================================ */

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 2px solid #f0f0f0;
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: #495057;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 2px solid #f0f0f0;
    padding: 1rem 1.5rem;
}

/* ============================================
   Loading Spinner
   ============================================ */

.spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.2em;
}

/* ============================================
   Responsive Improvements
   ============================================ */

@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .table-responsive {
        border-radius: 8px;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .btn, .card-tools, .pagination {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}
