/* 📄 SmΔrt Document Reader Manager Styles - Popup Style */

.document-reader-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    max-height: 90vh;
    z-index: 20000;
    display: none;
    transition: all 0.3s ease;
}

.document-reader-container.active {
    display: block;
}

.document-reader-container.dragging {
    transition: none;
    z-index: 25000;
    transform: none !important; /* Remove centering transform when dragging */
}

.document-reader-panel {
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid rgba(33, 150, 243, 0.6);
    border-radius: 12px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: white;
    transition: all 0.3s ease;
}

.document-reader-panel.dragging {
    transition: none;
    z-index: 25000;
}

.document-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.9) 0%, rgba(21, 101, 192, 0.9) 100%);
    color: white;
    border-radius: 10px 10px 0 0;
    margin: -2px -2px 0 -2px;
    cursor: grab;
    user-select: none;
}

.document-panel-header:active {
    cursor: grabbing;
}

.document-panel-title {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.document-header-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.doc-control-collapse,
.doc-control-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.doc-control-collapse:hover,
.doc-control-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.document-panel-content {
    padding: 20px;
    background: rgba(20, 20, 40, 0.9);
    backdrop-filter: blur(5px);
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: auto;
}

/* Collapsed state - hide content but keep header */
.document-reader-panel.collapsed .document-panel-content {
    display: none;
}

.doc-section {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(15, 15, 35, 0.8);
    border-radius: 10px;
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.doc-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-input-row {
    margin-bottom: 12px;
}

.doc-url-input {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(10, 10, 25, 0.9);
    color: white;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.doc-url-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.doc-url-input:focus {
    outline: none;
    border-color: rgba(100, 181, 246, 0.8);
    background: rgba(0, 0, 0, 0.4);
}

.doc-quick-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.doc-action-btn {
    flex: 1;
    padding: 10px 15px;
    background: rgba(33, 150, 243, 0.2);
    border: 2px solid rgba(33, 150, 243, 0.4);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.doc-action-btn:hover {
    background: rgba(33, 150, 243, 0.4);
    border-color: rgba(33, 150, 243, 0.7);
    transform: translateY(-2px);
}

.doc-action-btn.primary {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-color: #4CAF50;
}

.doc-action-btn.primary:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
}

.doc-action-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.doc-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.doc-property-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.doc-property-row label {
    min-width: 80px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.doc-property-row select,
.doc-property-row input[type="range"] {
    flex: 1;
}

.doc-property-row select {
    padding: 8px;
    background: rgba(10, 10, 25, 0.9);
    border: 2px solid rgba(33, 150, 243, 0.3);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

.doc-property-row select:focus {
    outline: none;
    border-color: rgba(33, 150, 243, 0.8);
}

.doc-property-row input[type="range"] {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.doc-property-row input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #64B5F6;
    cursor: pointer;
}

.doc-property-value {
    min-width: 60px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: #64B5F6;
}

/* Improved Toggle Style - No round slider */
.doc-toggle-setting {
    margin-bottom: 12px;
}

.doc-toggle-setting label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.doc-toggle-setting label:hover {
    background: rgba(33, 150, 243, 0.15);
    border-color: rgba(33, 150, 243, 0.3);
}

/* Custom checkbox styling - pill shape that fills */
.doc-toggle-setting input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.doc-toggle-setting input[type="checkbox"]::before {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.doc-toggle-setting input[type="checkbox"]:checked {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.8) 0%, rgba(21, 101, 192, 0.9) 100%);
    border-color: rgba(33, 150, 243, 0.9);
}

.doc-toggle-setting input[type="checkbox"]:checked::before {
    content: '✓';
    color: white;
    font-weight: bold;
}

.doc-toggle-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

/* Document Navigation */
.doc-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.doc-nav-btn {
    background: rgba(100, 181, 246, 0.3);
    border: 2px solid rgba(100, 181, 246, 0.5);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.doc-nav-btn:hover {
    background: rgba(100, 181, 246, 0.5);
    border-color: rgba(100, 181, 246, 0.8);
    transform: scale(1.05);
}

.doc-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.doc-current-info {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #64B5F6;
}

.doc-active-list {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
}

.doc-empty-state {
    padding: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

/* Counter in header */
.doc-counter {
    font-size: 14px;
    font-weight: normal;
    margin-left: 8px;
    opacity: 0.8;
}

.doc-active-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.doc-active-item:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(100, 181, 246, 0.5);
}

.doc-active-item.active {
    background: rgba(100, 181, 246, 0.3);
    border-color: rgba(100, 181, 246, 0.8);
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.3);
}

.doc-item-icon {
    font-size: 20px;
}

.doc-item-name {
    flex: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.doc-item-remove {
    background: rgba(255, 0, 0, 0.3);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.doc-item-remove:hover {
    background: rgba(255, 0, 0, 0.7);
}

.document-panel-actions {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
}

/* Document Overlay Styles */
.document-overlay {
    position: fixed;
    background: rgba(20, 20, 30, 0.95);
    border: 2px solid rgba(33, 150, 243, 0.6);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.document-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    user-select: none;
}

.document-title {
    font-size: 14px;
    font-weight: 600;
}

.document-controls {
    display: flex;
    gap: 8px;
}

.doc-btn-minimize,
.doc-btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.doc-btn-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

.doc-btn-close:hover {
    background: rgba(255, 0, 0, 0.8);
}

.document-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
}

.document-iframe.with-border {
    border: 3px solid #1e3c72;
}

.document-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: rgba(30, 60, 114, 0.8);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    border-top-left-radius: 4px;
}

/* Scrollbar Styling - Enhanced */
.document-panel-content::-webkit-scrollbar,
.doc-active-list::-webkit-scrollbar {
    width: 10px;
}

.document-panel-content::-webkit-scrollbar-track,
.doc-active-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin: 5px 0;
}

.document-panel-content::-webkit-scrollbar-thumb,
.doc-active-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(100, 181, 246, 0.6), rgba(33, 150, 243, 0.8));
    border-radius: 5px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.document-panel-content::-webkit-scrollbar-thumb:hover,
.doc-active-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(100, 181, 246, 0.8), rgba(33, 150, 243, 1));
    border-color: rgba(0, 0, 0, 0.3);
}

/* Firefox scrollbar */
.document-panel-content,
.doc-active-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 181, 246, 0.6) rgba(0, 0, 0, 0.3);
}

/* Dark Text Theme Support - More Transparent (Clear Mode) */
body.dark-text-theme .document-reader-panel {
    background: rgba(20, 20, 45, 0.75);
    border-color: rgba(33, 150, 243, 0.5);
    backdrop-filter: blur(15px);
}

body.dark-text-theme .document-panel-content {
    background: rgba(15, 15, 35, 0.7);
}

body.dark-text-theme .document-panel-header {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.85) 0%, rgba(21, 101, 192, 0.85) 100%);
}

body.dark-text-theme .doc-section {
    background: rgba(15, 15, 35, 0.6);
    border-color: rgba(33, 150, 243, 0.4);
}

body.dark-text-theme .doc-section h4,
body.dark-text-theme .doc-property-row label,
body.dark-text-theme .doc-toggle-label,
body.dark-text-theme .doc-item-name {
    background: transparent;
    color: rgba(255, 255, 255, 0.95);
}

body.dark-text-theme .doc-url-input,
body.dark-text-theme .doc-property-row select {
    background: rgba(10, 10, 25, 0.9);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(33, 150, 243, 0.4);
}

body.dark-text-theme .doc-url-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-text-theme .doc-property-value {
    color: #64B5F6;
}

body.dark-text-theme .doc-active-item {
    background: rgba(20, 20, 45, 0.9);
    border-color: rgba(33, 150, 243, 0.4);
}

body.dark-text-theme .doc-active-item .doc-item-name {
    color: #64B5F6;
}

body.dark-text-theme .doc-empty-state {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-text-theme .doc-action-btn {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.4);
    color: white;
}

body.dark-text-theme .doc-action-btn:hover {
    background: rgba(33, 150, 243, 0.4);
    border-color: rgba(33, 150, 243, 0.7);
}

body.dark-text-theme .doc-toggle-setting label {
    background: rgba(0, 0, 0, 0.3);
}

body.dark-text-theme .doc-toggle-setting label:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Animation for panel opening */
@keyframes slideInFromRight {
    from {
        right: -450px;
    }
    to {
        right: 0;
    }
}

/* ========================================
   Styled Scrollbar for Document Reader (Blue Theme)
   ======================================== */
.document-panel-content::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.document-panel-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin: 5px 0;
}

.document-panel-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.6), rgba(21, 101, 192, 0.8));
    border-radius: 5px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.document-panel-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.8), rgba(21, 101, 192, 1));
    border-color: rgba(0, 0, 0, 0.3);
}

/* Firefox scrollbar */
.document-panel-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(33, 150, 243, 0.6) rgba(0, 0, 0, 0.3);
}