/* ===================================
   LINKS MANAGER STYLES
   =================================== */

/* Links View Container */
.links-view {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.links-header {
	padding: 12px 20px;
	border-bottom: 1px solid #e1e4e8;
	background: #ffffff;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-shrink: 0;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.links-header h1 {
    margin: 0;
	font-size: 18px;
    font-weight: 600;
	color: #24292e;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Match header icon size with Templates/Expanders */
.links-header h1 i {
	width: 18px;
	height: 18px;
}

.links-header-actions {
    display: flex;
    gap: 10px;
}

/* Main Container */
.links-main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Split Panels */
.links-left-panel,
.links-right-panel {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.links-left-panel {
    background: #ffffff;
    border-right: 1px solid #e9ecef;
    min-width: 280px;
    /* Pre-size to Split.js default to avoid flicker before init */
    flex: 0 0 35%;
}

.links-right-panel {
    background: #ffffff;
    min-width: 400px;
    /* Pre-size to Split.js default to avoid flicker before init */
    flex: 1 0 65%;
}

/* Search Container */
.links-search-container {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #ffffff;
    flex-shrink: 0;
}

.links-search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.links-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Links List */
.links-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.link-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.link-item:hover {
    background-color: #f8f9fa;
    transform: translateX(2px);
}

.link-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    transform: translateX(0);
}

.link-item.active:hover {
    background-color: #e3f2fd;
}

.link-title {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    margin: 0;
    line-height: 1.4;
}

.link-preview {
    color: #6c757d;
    font-size: 12px;
    line-height: 1.3;
    margin: 0;
    word-break: break-word;
}

.item-link {
    color: #a8a8a8;
    text-decoration: none;
    transition: color 0.2s;
}

.item-link:hover {
    color: #7c7c7c;
    text-decoration: underline;
}

/* Link Tags Styles */
.link-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.link-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 6px;
    min-height: 16px;
    align-items: center;
}

.link-tags .tag {
    font-size: 9px;
    padding: 1px 4px;
    max-width: 80px;
    border-radius: 10px;
}

.link-tags .add-tag-btn {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 10px;
    min-height: 12px;
}

.link-tags .tag-remove {
    width: 8px;
    height: 8px;
    font-size: 8px;
    margin-left: 2px;
}

/* Tag Filter for Links */
#linksTagFilter {
    padding: 8px 16px;
    border-bottom: 1px solid #e1e4e8;
    background: #ffffff;
}

#linksTagFilter .filter-tag {
    font-size: 10px;
    padding: 3px 8px;
}

/* Content Panel Tags */
#contentLinkTags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    min-height: 24px;
}

#contentLinkTags .tag {
    font-size: 11px;
    padding: 3px 8px;
}

/* Editor Header */
.links-editor-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #ffffff;
    flex-shrink: 0;
}

.links-title-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.links-title-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Editor Content */
.links-editor-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.links-content-textarea {
    flex: 1;
    width: 100%;
    padding: 20px;
    border: none;
    border-radius: 0;
    font-family: 'proxima-nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background: #ffffff;
    resize: none;
    overflow-y: auto;
    outline: none;
}

.links-content-textarea:focus {
    outline: none;
}

/* Editor Footer */
.links-editor-footer {
    padding: 16px;
    border-top: 1px solid #e1e4e8;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.links-footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Buttons */
.links-btn {
	padding: 6px 12px;
	border: 1px solid #d1d5da;
	border-radius: 6px;
	background: #ffffff;
	color: #24292e;
	font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
	gap: 6px;
	line-height: 1;
    text-decoration: none;
}

.links-btn:hover {
	background: #f6f8fa;
	border-color: #d1d5da;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ensure button icons match sizing in other headers */
.links-btn i {
	width: 14px;
	height: 14px;
}

.links-btn-primary {
    background: #39c0a3;
    color: white;
    border-color: #29a489;
}

.links-btn-primary:hover {
    background: #5FD0C0;
    border-color: #34BA9E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 186, 158, 0.3);
}

/* Save Status */
.links-save-status {
    font-size: 12px;
    color: #6a737d;
}

.links-save-status.saving {
    color: #f66a0a;
}

.links-save-status.saved {
    color: #28a745;
}

/* Empty State */
.links-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
}

.links-empty-state-icon {
    margin-bottom: 20px;
    opacity: 0.5;
}

.links-empty-state h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.links-empty-state p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

/* Import Modal */
.links-import-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.links-import-modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.links-import-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.links-import-modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.links-import-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.links-import-close:hover {
    background: #f8f9fa;
    color: #495057;
}

.links-import-modal-body {
    padding: 25px;
}

.links-import-modal-body p {
    margin: 0 0 15px 0;
    color: #6c757d;
    line-height: 1.5;
}

.links-csv-paste-area {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 2px dashed #ced4da;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    transition: border-color 0.2s;
    background: #f8f9fa;
}

.links-csv-paste-area:focus {
    outline: none;
    border-color: #007bff;
    background: #ffffff;
}

.links-import-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.links-import-modal-footer .links-btn {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Mobile layout: remove viewport constraints for natural scrolling */
    .links-view {
        height: auto;
        overflow: visible;
    }
    
    .links-main-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    
    .links-left-panel {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        max-height: 250px;
        min-height: 200px;
        width: 100%;
        flex: none;
        overflow-y: auto;
    }
    
    .links-right-panel {
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
        flex: none !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Hide Split.js gutters on mobile */
    .gutter {
        display: none;
    }
    
    .links-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .links-header h1 {
        margin: 0;
        text-align: left;
    }
    
    .links-header-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
    }
    
    /* Hide Import and Export buttons on mobile */
    .links-header-actions button[onclick="openLinksImportModal()"],
    .links-header-actions button[onclick="exportLinks()"] {
        display: none;
    }
    
    .links-btn {
        justify-content: center;
        white-space: nowrap;
    }
    
    .links-search-container {
        padding: 12px 16px;
        width: 100%;
    }
    
    .links-search-input,
    .links-title-input {
        width: 100%;
        box-sizing: border-box;
    }
    
    .link-item {
        padding: 10px 16px;
    }
    
    .links-editor-header {
        padding: 12px 16px;
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box !important;
    }
    
    .links-editor-content {
        padding: 12px 16px;
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .links-content-textarea {
        height: 400px;
        min-height: 400px;
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
        padding: 12px;
        box-sizing: border-box !important;
        resize: none;
    }
    
    .links-editor-footer {
        padding: 12px 16px;
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
    }
    
    .links-import-modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .links-header {
        padding: 12px 16px;
        gap: 10px;
    }
    
    .links-header h1 {
        font-size: 18px;
    }
    
    .links-header-actions {
        gap: 6px;
    }
    
    .links-search-container {
        padding: 10px 12px;
    }
    
    .link-item {
        padding: 8px 12px;
    }
    
    .links-editor-header,
    .links-editor-content,
    .links-editor-footer {
        padding: 10px 12px;
    }
    
    .links-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .links-content-textarea {
        padding: 8px;
    }
    
    .links-import-modal-content {
        width: 98%;
        margin: 5% auto;
        border-radius: 4px;
    }
    
    .links-import-modal-header,
    .links-import-modal-body,
    .links-import-modal-footer {
        padding: 12px 16px;
    }
}

/* Split.js Gutter Styles */
.gutter {
    background-color: #e9ecef;
    background-repeat: no-repeat;
    background-position: 50%;
    transition: background-color 0.2s;
}

.gutter:hover {
    background-color: #007bff;
}

.gutter.gutter-horizontal {
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+YMCjdSkxkODQ0NqLts2TIQG9GSzWmv1gAAm+gIgKFaWgMAAAAASUVORK5CYII=');
    cursor: col-resize;
}

.gutter.gutter-vertical {
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=');
    cursor: row-resize;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .links-container {
        background: #2c3e50;
    }
    
    .links-left-panel,
    .links-right-panel {
        background: #34495e;
        border-color: #4a5f7a;
    }
    
    .link-item {
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .link-item:hover {
        background-color: #3d566e;
    }
    
    .link-item.active {
        background-color: #2980b9;
        border-left-color: #3498db;
    }
    
    .link-title-input,
    .link-content-textarea,
    .links-search-box {
        background: #2c3e50;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .links-import-modal-content {
        background-color: #34495e;
        color: #ecf0f1;
    }
    
    .links-csv-paste-area {
        background: #2c3e50;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
}

/* Private Toggle Styles */
.links-private-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.links-private-container .private-label {
    font-size: 13px;
    font-weight: 500;
    color: #656d76;
}

.links-private-container .checkbox-wrapper-7 .tgl {
    display: none;
}

.links-private-container .checkbox-wrapper-7 .tgl,
.links-private-container .checkbox-wrapper-7 .tgl:after,
.links-private-container .checkbox-wrapper-7 .tgl:before,
.links-private-container .checkbox-wrapper-7 .tgl *,
.links-private-container .checkbox-wrapper-7 .tgl *:after,
.links-private-container .checkbox-wrapper-7 .tgl *:before,
.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn {
    box-sizing: border-box;
}

.links-private-container .checkbox-wrapper-7 .tgl::-moz-selection,
.links-private-container .checkbox-wrapper-7 .tgl:after::-moz-selection,
.links-private-container .checkbox-wrapper-7 .tgl:before::-moz-selection,
.links-private-container .checkbox-wrapper-7 .tgl *::-moz-selection,
.links-private-container .checkbox-wrapper-7 .tgl *:after::-moz-selection,
.links-private-container .checkbox-wrapper-7 .tgl *:before::-moz-selection,
.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn::-moz-selection,
.links-private-container .checkbox-wrapper-7 .tgl::selection,
.links-private-container .checkbox-wrapper-7 .tgl:after::selection,
.links-private-container .checkbox-wrapper-7 .tgl:before::selection,
.links-private-container .checkbox-wrapper-7 .tgl *::selection,
.links-private-container .checkbox-wrapper-7 .tgl *:after::selection,
.links-private-container .checkbox-wrapper-7 .tgl *:before::selection,
.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn::selection {
    background: none;
}

.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn {
    outline: 0;
    display: block;
    width: 42px;
    height: 22px;
    position: relative;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn:after,
.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn:before {
    position: relative;
    display: block;
    content: "";
    width: 50%;
    height: 100%;
}

.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn:after {
    left: 0;
}

.links-private-container .checkbox-wrapper-7 .tgl + .tgl-btn:before {
    display: none;
}

.links-private-container .checkbox-wrapper-7 .tgl:checked + .tgl-btn:after {
    left: 50%;
}

.links-private-container .checkbox-wrapper-7 .tgl-ios + .tgl-btn {
    background: #fbfbfb;
    border-radius: 2em;
    padding: 2px;
    transition: all 0.4s ease;
    border: 1px solid #e8eae9;
}

.links-private-container .checkbox-wrapper-7 .tgl-ios + .tgl-btn:after {
    border-radius: 2em;
    background: #fbfbfb;
    transition: left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), padding 0.3s ease, margin 0.3s ease;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 4px 0 rgba(0, 0, 0, 0.08);
}

.links-private-container .checkbox-wrapper-7 .tgl-ios + .tgl-btn:hover:after {
    will-change: padding;
}

.links-private-container .checkbox-wrapper-7 .tgl-ios + .tgl-btn:active {
    box-shadow: inset 0 0 0 2em #e8eae9;
}

.links-private-container .checkbox-wrapper-7 .tgl-ios + .tgl-btn:active:after {
    padding-right: 0.8em;
}

.links-private-container .checkbox-wrapper-7 .tgl-ios:checked + .tgl-btn {
    background: #86d993;
}

.links-private-container .checkbox-wrapper-7 .tgl-ios:checked + .tgl-btn:active {
    box-shadow: none;
}

.links-private-container .checkbox-wrapper-7 .tgl-ios:checked + .tgl-btn:active:after {
    margin-left: -0.8em;
} 