/**
 * Global Document Selection Styles
 * Version: 1.0.0
 */

/* ============================================
   CHECKBOX STYLING
   ============================================ */

.doc-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0891b2;
    margin: 0;
}

.doc-checkbox-cell {
    width: 50px;
    text-align: center;
    vertical-align: middle;
    padding: 12px 8px !important;
}

.select-all-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0891b2;
    margin: 0;
}

/* ============================================
   FLOATING ACTION BAR
   ============================================ */

.document-action-bar {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    z-index: 1040;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    padding: 16px 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    max-width: 95vw;
    border: 1px solid #e2e8f0;
    overflow: visible;
}

.document-action-bar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.action-bar-content {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: nowrap;
    overflow: visible;
}

/* ============================================
   SELECTION INFO
   ============================================ */

.selection-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 24px;
    border-right: 2px solid #e2e8f0;
    min-width: 140px;
}

.btn-close-selection {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.btn-close-selection:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-close-selection i {
    font-size: 14px;
}

.selection-count {
    font-weight: 600;
    color: #0891b2;
    font-size: 15px;
    white-space: nowrap;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    overflow: visible;
}

.btn-action {
    background: white;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.btn-action:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-action:active:not(:disabled) {
    transform: translateY(0);
}

.btn-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-action i {
    font-size: 14px;
}

/* SignPack button - Purple gradient */
.btn-action.btn-signpack {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    font-weight: 600;
}

.btn-action.btn-signpack:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Delete button - Red */
.btn-action.btn-danger {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.btn-action.btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

/* ============================================
   SHARE SPLIT BUTTON GROUP
   ============================================ */

.share-split {
    display: inline-flex;
    align-items: stretch;
}

.share-split .btn-action {
    margin: 0;
}

.share-split .btn-action:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.share-split .dropdown-toggle-split {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: 12px;
    padding-right: 12px;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.share-split:hover .btn-action {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.share-split .dropdown-toggle-split::after {
    margin-left: 0;
}

/* Share dropdown menu styling */
.share-menu {
    min-width: 320px;
    padding: 0;
    margin-top: 0;
    z-index: 1100;
}

.share-menu .share-channels button {
    border-radius: 8px;
    font-size: 13px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.share-menu .share-channels button:not(:disabled):hover {
    background: #f0f9ff;
    border-color: #0891b2;
    transform: translateY(-1px);
}

.share-menu .share-channels button:disabled {
    cursor: not-allowed;
    position: relative;
}

.share-menu .share-channels button .badge {
    font-size: 9px;
    padding: 2px 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.share-type-group .btn {
    font-size: 13px;
    padding: 8px 12px;
}

.share-type-group .btn-check:checked + .btn {
    background: #0891b2;
    border-color: #0891b2;
    color: white;
}

/* ============================================
   ROW SELECTION HIGHLIGHT
   ============================================ */

.doc-row {
    transition: background-color 0.2s ease;
}

.doc-row.selected {
    background-color: #f0f9ff !important;
}

.doc-row:hover {
    background-color: #f8fafc;
}

.doc-row.selected:hover {
    background-color: #e0f2fe !important;
}

/* Card-based document lists */
.doc-card.selected {
    background-color: #f0f9ff !important;
    border-color: #0891b2 !important;
}

/* ============================================
   NOTIFICATION TOAST
   ============================================ */

.doc-selection-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1050;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 300px;
    border-left: 4px solid #0891b2;
}

.doc-selection-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.doc-selection-toast i {
    font-size: 20px;
}

.doc-selection-toast span {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

/* Toast variants */
.doc-selection-toast.toast-success {
    border-left-color: #10b981;
}

.doc-selection-toast.toast-success i {
    color: #10b981;
}

.doc-selection-toast.toast-error {
    border-left-color: #ef4444;
}

.doc-selection-toast.toast-error i {
    color: #ef4444;
}

.doc-selection-toast.toast-warning {
    border-left-color: #f59e0b;
}

.doc-selection-toast.toast-warning i {
    color: #f59e0b;
}

.doc-selection-toast.toast-info {
    border-left-color: #3b82f6;
}

.doc-selection-toast.toast-info i {
    color: #3b82f6;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 992px) {
    .document-action-bar {
        min-width: auto;
        width: 95vw;
        padding: 14px 18px;
        top: 60px;
    }
    
    .action-bar-content {
        flex-direction: column;
        gap: 14px;
    }
    
    .selection-info {
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
        padding-right: 0;
        padding-bottom: 12px;
        width: 100%;
        justify-content: center;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .btn-action {
        font-size: 13px;
        padding: 8px 14px;
    }
}

@media (max-width: 768px) {
    .document-action-bar {
        top: 56px;
        border-radius: 12px;
    }
    
    .btn-action {
        font-size: 12px;
        padding: 7px 12px;
    }
    
    .btn-action span {
        display: none;
    }
    
    .btn-action i {
        margin: 0;
    }
    
    .doc-selection-toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        min-width: auto;
    }
}

/* ============================================
   TABLE ENHANCEMENTS
   ============================================ */

/* Ensure table headers align with checkboxes */
.table thead th {
    vertical-align: middle;
}

/* Better checkbox alignment in tables */
.table .doc-checkbox-cell {
    vertical-align: middle;
}

/* Smooth transitions for table rows */
.table tbody tr {
    transition: background-color 0.15s ease;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus states */
.doc-checkbox:focus,
.select-all-checkbox:focus {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}

.btn-action:focus {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}

.btn-close-selection:focus {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .document-action-bar {
        border: 2px solid #000;
    }
    
    .btn-action {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .document-action-bar,
    .doc-row,
    .btn-action,
    .doc-selection-toast {
        transition: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .document-action-bar,
    .doc-checkbox,
    .select-all-checkbox,
    .doc-selection-toast {
        display: none !important;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

.btn-action .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.doc-selection-disabled {
    pointer-events: none;
    opacity: 0.5;
}

.doc-selection-hidden {
    display: none !important;
}
