/* Common styles for authenticated content */
.table-modern thead { background: #f8fafc; }
.table-modern tbody tr { transition: transform .1s ease, box-shadow .2s ease; }
.table-modern tbody tr:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.table-modern th, .table-modern td { vertical-align: middle; }

.table-sticky { position: sticky; top: 0; z-index: 1; }

.card-modern { border: 0; box-shadow: 0 6px 18px rgba(0,0,0,.06); }

.btn-soft { border: 1px solid rgba(0,0,0,.08); }

.badge-dot { position: relative; padding-left: .75rem; }
.badge-dot::before { content:''; position:absolute; left:.25rem; top:50%; width:.4rem; height:.4rem; border-radius:50%; transform:translateY(-50%); background: currentColor; }

.pagination .page-link { border-radius: .375rem; }

/* Icon circle containers for admin dashboard */
.icon-circle {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.icon-circle i {
    font-size: 1.5rem;
}

/* Enhanced contrast for icon circles */
.icon-circle.bg-primary { background-color: rgba(13, 110, 253, 0.15) !important; }
.icon-circle.bg-success { background-color: rgba(25, 135, 84, 0.15) !important; }
.icon-circle.bg-info { background-color: rgba(13, 202, 240, 0.15) !important; }
.icon-circle.bg-warning { background-color: rgba(255, 193, 7, 0.20) !important; }
.icon-circle.bg-danger { background-color: rgba(220, 53, 69, 0.15) !important; }

/* Control Panel icon boxes with better contrast */
.cp-icon-box {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.cp-icon-box i {
    font-size: 1.75rem;
    transition: transform 0.3s ease;
    opacity: 1 !important;
}

.cp-icon-box.bg-primary {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.2) 0%, rgba(13, 110, 253, 0.1) 100%) !important;
    border: 2px solid rgba(13, 110, 253, 0.2);
}

.cp-icon-box.bg-primary i {
    color: #0d6efd !important;
}

.cp-icon-box.bg-success {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.2) 0%, rgba(25, 135, 84, 0.1) 100%) !important;
    border: 2px solid rgba(25, 135, 84, 0.2);
}

.cp-icon-box.bg-success i {
    color: #198754 !important;
}

.cp-icon-box.bg-info {
    background: linear-gradient(135deg, rgba(13, 202, 240, 0.2) 0%, rgba(13, 202, 240, 0.1) 100%) !important;
    border: 2px solid rgba(13, 202, 240, 0.2);
}

.cp-icon-box.bg-info i {
    color: #0dcaf0 !important;
}

.cp-icon-box.bg-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.25) 0%, rgba(255, 193, 7, 0.15) 100%) !important;
    border: 2px solid rgba(255, 193, 7, 0.3);
}

.cp-icon-box.bg-warning i {
    color: #ffc107 !important;
}

.card:hover .cp-icon-box {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card:hover .cp-icon-box i {
    transform: scale(1.1);
}

/* Prevent table overflow causing horizontal scroll */
.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ========== Common Dialog System ========== */

/* Dialog Overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.dialog-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dialog Container */
.dialog-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

/* Dialog Header */
.dialog-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dialog-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dialog-icon i {
    font-size: 1.5rem;
}

.dialog-icon.dialog-info {
    background: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
}

.dialog-icon.dialog-success {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}

.dialog-icon.dialog-warning {
    background: rgba(255, 193, 7, 0.20);
    color: #ffc107;
}

.dialog-icon.dialog-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.dialog-icon.dialog-question {
    background: rgba(13, 110, 253, 0.15);
    color: #0d6efd;
}

.dialog-title-wrapper {
    flex: 1;
}

.dialog-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.dialog-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: all 0.2s;
}

.dialog-close:hover {
    color: #1f2937;
    transform: scale(1.1);
}

/* Dialog Body */
.dialog-body {
    padding: 1.5rem;
    color: #6b7280;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
}

.dialog-body p {
    margin: 0;
}

/* Dialog Footer */
.dialog-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.dialog-btn {
    padding: 0.625rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9375rem;
}

.dialog-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dialog-btn-primary {
    background: #0d6efd;
    color: white;
}

.dialog-btn-primary:hover {
    background: #0b5ed7;
}

.dialog-btn-success {
    background: #198754;
    color: white;
}

.dialog-btn-success:hover {
    background: #157347;
}

.dialog-btn-danger {
    background: #dc3545;
    color: white;
}

.dialog-btn-danger:hover {
    background: #bb2d3b;
}

.dialog-btn-warning {
    background: #ffc107;
    color: #000;
}

.dialog-btn-warning:hover {
    background: #ffca2c;
}

.dialog-btn-secondary {
    background: #6c757d;
    color: white;
}

.dialog-btn-secondary:hover {
    background: #5c636a;
}

.dialog-btn-outline {
    background: white;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.dialog-btn-outline:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

@media (max-width: 576px) {
    .toast-container {
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
    }
}

.toast-notification {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    animation: slideInRight 0.3s ease-out;
    max-width: 100%;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(120%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon i {
    font-size: 1.25rem;
}

.toast-info .toast-icon {
    background: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
}

.toast-success .toast-icon {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}

.toast-warning .toast-icon {
    background: rgba(255, 193, 7, 0.20);
    color: #ffc107;
}

.toast-danger .toast-icon {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.toast-content {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
}

.toast-title {
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.toast-message {
    color: #6b7280;
    margin: 0;
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #1f2937;
    transform: scale(1.1);
}

/* Loading Spinner */
.dialog-loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Input Prompt Dialog */
.dialog-input-group {
    margin-top: 1rem;
}

.dialog-input-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.dialog-input-group input,
.dialog-input-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.dialog-input-group input:focus,
.dialog-input-group textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.dialog-input-group textarea {
    resize: vertical;
    min-height: 100px;
}

.dialog-input-error {
    color: #dc3545;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 576px) {
    .dialog-container {
        width: 95%;
        max-width: none;
    }
    
    .dialog-header {
        padding: 1rem;
    }
    
    .dialog-body {
        padding: 1rem;
    }
    
    .dialog-footer {
        padding: 1rem;
        flex-direction: column-reverse;
    }
    
    .dialog-btn {
        width: 100%;
    }
}
