/* Enhanced Social Sharing and Theme System Styles */

/* Theme Controls Panel */
.theme-controls-panel {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10002 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-controls-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

[data-theme="dark"] .theme-controls-panel {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .theme-controls-panel {
    background: #f4ecd8;
    border: 1px solid #d4c8b4;
}

[data-theme="high-contrast"] .theme-controls-panel {
    background: #000000;
    border: 2px solid #ffffff;
}

.theme-controls-header {
    padding: 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 16px 16px 0 0;
}

[data-theme="dark"] .theme-controls-header {
    background: #2c3e50;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .theme-controls-header {
    background: #e8dcc8;
    border-bottom-color: #d4c8b4;
}

[data-theme="high-contrast"] .theme-controls-header {
    background: #1a1a1a;
    border-bottom-color: #ffffff;
}

.theme-controls-header h3 {
    margin: 0;
    color: #2c5aa0;
    font-size: 20px;
    font-weight: 600;
}

[data-theme="dark"] .theme-controls-header h3 {
    color: #ecf0f1;
}

[data-theme="sepia"] .theme-controls-header h3 {
    color: #5c4b37;
}

[data-theme="high-contrast"] .theme-controls-header h3 {
    color: #ffffff;
}

.theme-controls-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.theme-controls-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .theme-controls-close {
    color: #ccc;
}

[data-theme="dark"] .theme-controls-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .theme-controls-close {
    color: #7a6a56;
}

[data-theme="sepia"] .theme-controls-close:hover {
    background: rgba(92, 75, 55, 0.1);
}

[data-theme="high-contrast"] .theme-controls-close {
    color: #ffffff;
}

[data-theme="high-contrast"] .theme-controls-close:hover {
    background: #333333;
}

.theme-controls-content {
    padding: 24px;
}

.theme-option {
    margin-bottom: 16px;
}

.theme-option-label {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

[data-theme="dark"] .theme-option-label {
    border-color: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
    /* White text for labels in dark mode */
}

[data-theme="sepia"] .theme-option-label {
    border-color: #d4c8b4;
    color: #5c4b37;
    background: #faf7f0;
}

[data-theme="high-contrast"] .theme-option-label {
    border-color: #ffffff;
    color: #ffffff;
    background: #000000;
}

.theme-option-label:hover {
    border-color: #4a90e2;
    background: #f8f9fa;
}

[data-theme="dark"] .theme-option-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="sepia"] .theme-option-label:hover {
    border-color: #8b6914;
    background: #e8dcc8;
}

[data-theme="high-contrast"] .theme-option-label:hover {
    border-color: #00ff00;
    background: #1a1a1a;
}

.theme-radio {
    margin: 0;
}

.theme-radio:checked+.theme-preview {
    border-color: #4a90e2;
}

.theme-option-label:has(.theme-radio:checked) {
    border-color: #4a90e2;
    background: #f0f7ff;
}

[data-theme="dark"] .theme-option-label:has(.theme-radio:checked) {
    background: rgba(74, 144, 226, 0.2);
}

[data-theme="sepia"] .theme-option-label:has(.theme-radio:checked) {
    border-color: #8b6914;
    background: #e8dcc8;
}

[data-theme="high-contrast"] .theme-option-label:has(.theme-radio:checked) {
    border-color: #00ff00;
    background: #1a1a1a;
}

.theme-preview {
    width: 60px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #ddd;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.theme-preview-light {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.theme-preview-dark {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.theme-preview-sepia {
    background: linear-gradient(135deg, #f4f1e8 0%, #e8dcc0 100%);
}

.theme-preview-contrast {
    background: linear-gradient(135deg, #000000 0%, #ffffff 50%, #000000 100%);
}

.preview-header {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    height: 8px;
    border-radius: 2px;
}

.theme-preview-light .preview-header {
    background: #4a90e2;
}

.theme-preview-dark .preview-header {
    background: #63b3ed;
}

.theme-preview-sepia .preview-header {
    background: #8b4513;
}

.theme-preview-contrast .preview-header {
    background: #ffff00;
}

.preview-content {
    position: absolute;
    top: 16px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border-radius: 2px;
}

.theme-preview-light .preview-content {
    background: #ffffff;
}

.theme-preview-dark .preview-content {
    background: #4a5568;
}

.theme-preview-sepia .preview-content {
    background: #faf7f0;
}

.theme-preview-contrast .preview-content {
    background: repeating-linear-gradient(45deg, #000, #000 2px, #fff 2px, #fff 4px);
}

.theme-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

[data-theme="dark"] .theme-name {
    color: #ecf0f1;
}

[data-theme="sepia"] .theme-name {
    color: #5c4b37;
}

[data-theme="high-contrast"] .theme-name {
    color: #ffffff;
}

.theme-controls-footer {
    padding: 0 24px 24px;
    border-top: 1px solid #eee;
    margin-top: 20px;
    padding-top: 20px;
}

[data-theme="dark"] .theme-controls-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .theme-controls-footer {
    border-top-color: #d4c8b4;
}

[data-theme="high-contrast"] .theme-controls-footer {
    border-top-color: #ffffff;
}

.auto-theme-option,
.theme-transition-option {
    margin-bottom: 12px;
}

.auto-theme-option label,
.theme-transition-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

[data-theme="dark"] .auto-theme-option label,
[data-theme="dark"] .theme-transition-option label {
    color: #ccc;
}

[data-theme="sepia"] .auto-theme-option label,
[data-theme="sepia"] .theme-transition-option label {
    color: #7a6a56;
}

[data-theme="high-contrast"] .auto-theme-option label,
[data-theme="high-contrast"] .theme-transition-option label {
    color: #ffffff;
}

/* Share Button - Next to Chapter Title or Floating */
.floating-share-btn {
    position: absolute;
    top: 50%;
    left: -60px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: #32465acc;
    color: white;
    border: 2px solid #32465acc;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(50, 70, 90, 0.3);
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.floating-share-btn svg {
    width: 20px;
    height: 20px;
    stroke: #ff6639;
    /* Brand accent color */
    display: block;
}

.floating-share-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(50, 70, 90, 0.5);
    background: #32465aee;
    border-color: #32465aee;
}

.share-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    max-width: 100%;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden;
}

[data-theme="dark"] .share-panel {
    background: #1a1a1a;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .share-panel {
    background: #f4ecd8;
    border-left: 1px solid #d4c8b4;
}

[data-theme="high-contrast"] .share-panel {
    background: #000000;
    border-left: 2px solid #ffffff;
}

.share-panel.visible {
    right: 0;
    visibility: visible;
}

.share-panel-header {
    padding: 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

[data-theme="dark"] .share-panel-header {
    background: #2c3e50;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .share-panel-header {
    background: #e8dcc8;
    border-bottom-color: #d4c8b4;
}

[data-theme="high-contrast"] .share-panel-header {
    background: #1a1a1a;
    border-bottom-color: #ffffff;
}

.share-panel-header h3 {
    margin: 0;
    color: #2c5aa0;
    font-size: 20px;
    font-weight: 600;
}

[data-theme="dark"] .share-panel-header h3 {
    color: #ecf0f1;
}

[data-theme="sepia"] .share-panel-header h3 {
    color: #5c4b37;
}

[data-theme="high-contrast"] .share-panel-header h3 {
    color: #ffffff;
}

.share-panel-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.share-panel-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .share-panel-close {
    color: #ccc;
}

[data-theme="dark"] .share-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .share-panel-close {
    color: #7a6a56;
}

[data-theme="sepia"] .share-panel-close:hover {
    background: rgba(92, 75, 55, 0.1);
}

[data-theme="high-contrast"] .share-panel-close {
    color: #ffffff;
}

[data-theme="high-contrast"] .share-panel-close:hover {
    background: #333333;
}

.share-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.share-preview {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border-left: 4px solid #4a90e2;
}

[data-theme="dark"] .share-preview {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="sepia"] .share-preview {
    background: #e8dcc8;
    border-left-color: #8b6914;
}

[data-theme="high-contrast"] .share-preview {
    background: #1a1a1a;
    border-left-color: #00ff00;
}

.share-preview-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

[data-theme="dark"] .share-preview-title {
    color: #ecf0f1;
}

[data-theme="sepia"] .share-preview-title {
    color: #5c4b37;
}

[data-theme="high-contrast"] .share-preview-title {
    color: #ffffff;
}

.share-preview-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

[data-theme="dark"] .share-preview-description {
    color: #bdc3c7;
}

[data-theme="sepia"] .share-preview-description {
    color: #7a6a56;
}

[data-theme="high-contrast"] .share-preview-description {
    color: #f0f0f0;
}

.share-preview-url {
    color: #4a90e2;
    font-size: 12px;
    word-break: break-all;
}

.share-platforms h4,
.share-actions h4 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

[data-theme="dark"] .share-platforms h4,
[data-theme="dark"] .share-actions h4 {
    color: #ecf0f1;
}

[data-theme="sepia"] .share-platforms h4,
[data-theme="sepia"] .share-actions h4 {
    color: #5c4b37;
}

[data-theme="high-contrast"] .share-platforms h4,
[data-theme="high-contrast"] .share-actions h4 {
    color: #ffffff;
}

.share-buttons-grid,
.share-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.share-btn,
.action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: right;
}

[data-theme="dark"] .share-btn,
[data-theme="dark"] .action-btn {
    background: #2c3e50;
    border-color: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
}

[data-theme="sepia"] .share-btn,
[data-theme="sepia"] .action-btn {
    background: #faf7f0;
    border-color: #d4c8b4;
    color: #5c4b37;
}

[data-theme="high-contrast"] .share-btn,
[data-theme="high-contrast"] .action-btn {
    background: #000000;
    border-color: #ffffff;
    color: #ffffff;
}

.share-btn:hover,
.action-btn:hover {
    border-color: #4a90e2;
    background: #f0f7ff;
    transform: translateY(-2px);
}

[data-theme="dark"] .share-btn:hover,
[data-theme="dark"] .action-btn:hover {
    background: rgba(74, 144, 226, 0.2);
}

[data-theme="sepia"] .share-btn:hover,
[data-theme="sepia"] .action-btn:hover {
    border-color: #8b6914;
    background: #e8dcc8;
}

[data-theme="high-contrast"] .share-btn:hover,
[data-theme="high-contrast"] .action-btn:hover {
    border-color: #00ff00;
    background: #1a1a1a;
}

.share-icon,
.action-icon {
    font-size: 20px;
    width: 24px;
    height: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.share-icon svg,
.action-icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* Social platform specific colors */
.share-btn[data-platform="facebook"] .share-icon svg {
    fill: #1877F2;
}

.share-btn[data-platform="twitter"] .share-icon svg {
    fill: #000000;
}

[data-theme="dark"] .share-btn[data-platform="twitter"] .share-icon svg {
    fill: #ffffff;
}

.share-btn[data-platform="whatsapp"] .share-icon svg {
    fill: #25D366;
}

.share-btn[data-platform="telegram"] .share-icon svg {
    fill: #0088cc;
}

.share-btn[data-platform="linkedin"] .share-icon svg {
    fill: #0A66C2;
}

.share-btn[data-platform="email"] .share-icon svg {
    stroke: #666;
}

[data-theme="dark"] .share-btn[data-platform="email"] .share-icon svg {
    stroke: #ecf0f1;
}

/* Action button icons */
.action-btn svg {
    stroke: #4a90e2;
}

.action-btn#generate-qr svg {
    fill: #4a90e2;
    stroke: none;
}

.share-name,
.action-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

[data-theme="dark"] .share-name,
[data-theme="dark"] .action-name {
    color: #ecf0f1;
}

[data-theme="sepia"] .share-name,
[data-theme="sepia"] .action-name {
    color: #5c4b37;
}

[data-theme="high-contrast"] .share-name,
[data-theme="high-contrast"] .action-name {
    color: #ffffff;
}

/* Native Share */
.native-share {
    margin-top: 16px;
}

.native-share-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid #4a90e2;
    border-radius: 12px;
    background: #4a90e2;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.native-share-btn:hover {
    background: #2c5aa0;
    border-color: #2c5aa0;
}

/* Theme Notification */
.social-theme-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
}

.social-theme-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.social-theme-notification-success {
    background: #4caf50;
}

.social-theme-notification-error {
    background: #f44336;
}

/* QR Code Modal */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1003;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.qr-modal.visible {
    opacity: 1;
    visibility: visible;
}

.qr-modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

[data-theme="dark"] .qr-modal-content {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .qr-modal-content {
    background: #f4ecd8;
    border: 1px solid #d4c8b4;
}

[data-theme="high-contrast"] .qr-modal-content {
    background: #000000;
    border: 2px solid #ffffff;
}

.qr-modal.visible .qr-modal-content {
    transform: scale(1);
}

.qr-modal-header {
    padding: 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

[data-theme="dark"] .qr-modal-header {
    background: #2c3e50;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="sepia"] .qr-modal-header {
    background: #e8dcc8;
    border-bottom-color: #d4c8b4;
}

[data-theme="high-contrast"] .qr-modal-header {
    background: #1a1a1a;
    border-bottom-color: #ffffff;
}

.qr-modal-header h3 {
    margin: 0;
    color: #2c5aa0;
    font-size: 18px;
    font-weight: 600;
}

[data-theme="dark"] .qr-modal-header h3 {
    color: #ecf0f1;
}

[data-theme="sepia"] .qr-modal-header h3 {
    color: #5c4b37;
}

[data-theme="high-contrast"] .qr-modal-header h3 {
    color: #ffffff;
}

.qr-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.qr-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .qr-modal-close {
    color: #ccc;
}

[data-theme="sepia"] .qr-modal-close {
    color: #7a6a56;
}

[data-theme="high-contrast"] .qr-modal-close {
    color: #ffffff;
}

.qr-modal-body {
    padding: 24px;
    text-align: center;
}

.qr-code-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

#qr-canvas {
    border: 1px solid #ddd;
    border-radius: 8px;
}

.qr-instructions {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

[data-theme="dark"] .qr-instructions {
    color: #bdc3c7;
}

[data-theme="sepia"] .qr-instructions {
    color: #7a6a56;
}

[data-theme="high-contrast"] .qr-instructions {
    color: #f0f0f0;
}

.qr-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.qr-actions button {
    padding: 10px 20px;
    border: 1px solid #4a90e2;
    border-radius: 6px;
    background: white;
    color: #4a90e2;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.qr-actions button:hover {
    background: #4a90e2;
    color: white;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .share-panel {
        width: 100%;
        right: -100%;
    }

    .share-buttons-grid,
    .share-actions-grid {
        grid-template-columns: 1fr;
    }

    .theme-controls-panel {
        width: 95%;
        max-width: 95%;
    }
}