/* Common styles */
.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

/* Forms */
.form-group { margin-bottom: 20px; }

label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 500; 
    color: #333; 
}

input[type="text"], 
input[type="password"],
select, 
textarea { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    font-size: 14px; 
    font-family: inherit; 
}

textarea { 
    min-height: 100px; 
    resize: vertical; 
}

textarea.code { 
    font-family: 'Courier New', monospace; 
    font-size: 13px; 
    background: #f8f9fa; 
}

.read-only { 
    background: #f8f9fa; 
    color: #666; 
}

/* Buttons */
.btn { 
    padding: 10px 20px; 
    background: #20c997; 
    color: white; 
    text-decoration: none; 
    border-radius: 4px; 
    display: inline-block; 
    border: none; 
    cursor: pointer; 
    font-size: 14px; 
}

.btn:hover { background: #17a589; }

.btn-secondary { 
    background: #6c757d; 
    margin-left: 10px; 
}

.btn-secondary:hover { background: #5a6268; }

.btn-success { background: #20c997; }
.btn-success:hover { background: #17a589; }

.btn-warning { background: #ffc107; color: #000; }
.btn-warning:hover { background: #e0a800; }

.btn-sm { 
    padding: 6px 12px; 
    font-size: 12px; 
}

/* Badges */
.badge { 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 12px; 
    font-weight: 500; 
    display: inline-block; 
}

/* Status and Priority badges historically existed here but were removed to prevent UI color overload and DataTables DOM flashing. */

/* Tables */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
}

th, td { 
    padding: 12px; 
    text-align: left; 
    border-bottom: 1px solid #ddd; 
}

th { 
    background: #f8f9fa; 
    font-weight: 600; 
}

tr:hover { background: #f8f9fa; }

/* Alerts */
.error { 
    background: #f8d7da; 
    color: #721c24; 
    padding: 12px; 
    border-radius: 4px; 
    margin-bottom: 20px; 
}

.required { color: #dc3545; }

.help-text { 
    font-size: 12px; 
    color: #666; 
    margin-top: 4px; 
}

/* Issue view specific */
.header { 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 20px; 
}

.header h1 { 
    margin-bottom: 15px; 
    color: #333; 
}

.meta { 
    display: flex; 
    gap: 20px; 
    flex-wrap: wrap; 
    font-size: 14px; 
    color: #666; 
    margin-top: 15px; 
}

.url-box { 
    background: #d4f4ea; 
    padding: 12px; 
    border-radius: 4px; 
    margin-top: 15px; 
    border-left: 3px solid #20c997; 
}

.url-box a { 
    color: #138c75; 
    text-decoration: none; 
    word-break: break-all; 
}

.url-box a:hover { text-decoration: underline; }

.error-log-box { 
    background: #2d2d2d; 
    color: #f8f8f2; 
    padding: 15px; 
    border-radius: 4px; 
    margin-top: 15px; 
    font-family: 'Courier New', monospace; 
    font-size: 13px; 
    overflow-x: auto; 
    white-space: pre-wrap; 
    word-break: break-all; 
}

.details { 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 20px; 
}

.detail-section { margin-bottom: 20px; }
.detail-section:last-child { margin-bottom: 0; }

.detail-section h3 { 
    font-size: 14px; 
    color: #666; 
    margin-bottom: 8px; 
    text-transform: uppercase; 
}

.detail-section p { 
    color: #333; 
    line-height: 1.6; 
    white-space: pre-wrap; 
}

/* Comments */
.comments { 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 20px; 
}

.comments h2 { 
    margin-bottom: 20px; 
    color: #333; 
}

.comment { 
    border-left: 3px solid #20c997; 
    padding: 15px; 
    margin-bottom: 15px; 
    background: #f8f9fa; 
    border-radius: 4px; 
}

.comment-header { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 10px; 
    font-size: 13px; 
}

.comment-author { 
    font-weight: 600; 
    color: #138c75; 
}

.comment-date { color: #999; }

.comment-text { 
    color: #333; 
    line-height: 1.6; 
}

.add-comment { 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.no-comments { 
    text-align: center; 
    padding: 30px; 
    color: #999; 
}

/* Status update */
.status-update { 
    background: #d4f4ea; 
    padding: 15px; 
    border-radius: 4px; 
    margin-bottom: 20px; 
    border-left: 3px solid #20c997;
}

.status-update form { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
    flex-wrap: wrap; 
}

/* Filters */
.filters { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 20px; 
    align-items: center; 
}

.filters select { 
    padding: 8px 12px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
}

/* Utility */
.no-issues { 
    text-align: center; 
    padding: 40px; 
    color: #999; 
}

.action-buttons { 
    display: flex; 
    gap: 10px; 
}

/* Login page styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #20c997 0%, #138c75 100%);
}

.login-box {
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 360px;
}

.login-box h1 {
    margin-bottom: 25px;
    color: #333;
    text-align: center;
    font-size: 22px;
    line-height: 1.3;
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
    font-size: 18px;
}

.password-toggle:hover {
    color: #20c997;
}

/* Split button - Save & Push to */
.split-btn-wrapper {
    position: relative;
    display: inline-flex;
}

.split-btn-main {
    padding: 10px 20px;
    background: #20c997;
    color: white;
    border: none;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.split-btn-main:hover { background: #17a589; }

.split-btn-toggle {
    padding: 10px 12px;
    background: #17a589;
    color: white;
    border: none;
    border-left: 1px solid #138c75;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
}

.split-btn-toggle:hover { background: #138c75; }

.split-btn-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 180px;
    margin-bottom: 5px;
}

.split-btn-dropdown.open { display: block; }

.split-btn-dropdown a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.split-btn-dropdown a:hover {
    background: #d4f4ea;
    color: #138c75;
}

.split-btn-dropdown .dropdown-header {
    padding: 8px 15px;
    font-size: 11px;
    text-transform: uppercase;
    color: #999;
    border-bottom: 1px solid #eee;
    cursor: default;
}

/* Split button hints */
.split-btn-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.split-btn-hint {
    color: #999;
    font-size: 13px;
}

.split-btn-subhint {
    color: #bbb;
    font-size: 12px;
    font-style: italic;
    margin-top: 8px;
}

.priority-select {
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container, .header { padding: 15px; }
    .header > div { flex-direction: column !important; align-items: stretch !important; }
    .action-buttons { margin-top: 15px; display: flex; gap: 10px; width: 100%; }
    .action-buttons a { flex: 1; text-align: center; margin: 0 !important; padding: 12px; }
    .meta { gap: 10px; flex-direction: column; align-items: flex-start; }
    
    .dataTables_wrapper .dataTables_paginate, .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter {
        float: none !important;
        text-align: center !important;
        margin-top: 10px;
    }
    .custom-filters-container {
        display: flex !important;
        flex-direction: column;
        margin-left: 0 !important;
        margin-top: 10px;
        height: auto !important;
        gap: 5px;
    }
    .custom-filters-container select { width: 100%; }
}

/* Quill Editor Specific Styles */
#quill-editor {
    min-height: 200px;
    height: auto;
    background: white;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

#quill-editor .ql-editor {
    min-height: 200px;
}

.ql-editor {
    height: auto;
    overflow-y: visible; /* Allows the content to organically stretch the container */
}

/* Adjust Toolbar Dropdown Widths to prevent text wrap */
.ql-snow .ql-picker.ql-font { width: 140px !important; }
.ql-snow .ql-picker.ql-size { width: 75px !important; }

/* Set Editor Base Font */
.ql-container { font-family: 'Avenir Next', 'Avenir', sans-serif !important; font-size: 14px; }
.ql-editor { font-family: 'Avenir Next', 'Avenir', sans-serif; }

/* Font Size Dropdown Labels */
.ql-snow .ql-picker.ql-size .ql-picker-label::before, .ql-snow .ql-picker.ql-size .ql-picker-item::before { content: '14px'; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="10px"]::before, .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="10px"]::before { content: '10px'; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="12px"]::before, .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="12px"]::before { content: '12px'; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="16px"]::before, .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="16px"]::before { content: '16px'; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="18px"]::before, .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="18px"]::before { content: '18px'; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="24px"]::before, .ql-snow .ql-picker.ql-size .ql-picker-item[data-value="24px"]::before { content: '24px'; }

/* Font Family Dropdown Labels */
.ql-snow .ql-picker.ql-font .ql-picker-label::before, .ql-snow .ql-picker.ql-font .ql-picker-item::before { content: 'Avenir Next'; font-family: 'Avenir Next', 'Avenir', sans-serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="Arial"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Arial"]::before { content: 'Arial'; font-family: 'Arial', sans-serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="Times New Roman"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Times New Roman"]::before { content: 'Times New Roman'; font-family: 'Times New Roman', serif; }
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="Courier"]::before, .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Courier"]::before { content: 'Courier'; font-family: 'Courier', monospace; }

/* Ensure code and code blocks in Quill editor look like code */
.ql-editor code {
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 0.9em;
    color: #e83e8c;
}

.ql-editor pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 13px;
    overflow-x: auto;
    margin-bottom: 1.2em;
    white-space: pre-wrap;
    border-left: 4px solid #20c997;
}

/* Sticky Quill Toolbar for long-form editing */
.ql-toolbar.ql-snow {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    border-top: none; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Knowledge Base Detail & Edit Views */
.kb-container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kb-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.kb-header h1 { font-size: 32px !important; color: #333; margin: 0 0 10px 0; }

.kb-meta { font-size: 13px; color: #666; display: flex; gap: 20px; }
.kb-meta span { font-weight: 500; }
.kb-meta strong { color: #333; }

.kb-content { 
    padding: 0 !important; 
    font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif; 
    font-size: 16px; 
    line-height: 1.6; 
}
.kb-content p { margin-bottom: 1.2em; }

.kb-attachments {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.kb-attachments h3 { font-size: 18px; margin-bottom: 15px; }

.kb-attachment-list { list-style: none; padding: 0; }
.kb-attachment-item { display: flex; align-items: center; justify-content: space-between; padding: 8px; border: 1px solid #eee; margin-bottom: 5px; border-radius: 4px; }
.kb-attachment-item a { color: #138c75; text-decoration: none; font-weight: 600; }
.kb-attachment-item a:hover { text-decoration: underline; }

.kb-screenshot-gallery { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 30px; }
.kb-screenshot-thumb { border: 1px solid #ddd; padding: 5px; border-radius: 4px; background: white; }
.kb-screenshot-thumb img { max-height: 250px; border-radius: 2px; }

.kb-actions { display: flex; gap: 10px; margin-top: 30px; }
.btn-kb-edit { background: #ffc107; color: #333; text-decoration: none; padding: 8px 20px; border-radius: 4px; font-weight: 600; transition: background 0.2s; }
.btn-kb-edit:hover { background: #e0ac08; }
.btn-kb-back { background: #f8f9fa; color: #666; text-decoration: none; padding: 8px 20px; border-radius: 4px; font-weight: 600; border: 1px solid #ddd; transition: background 0.2s; }
.btn-kb-back:hover { background: #eee; }
.btn-kb-save { background: #20c997; color: white; border: none; padding: 12px 30px; border-radius: 4px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-kb-save:hover { background: #138c75; }
.btn-kb-cancel { background: #6c757d; color: white; text-decoration: none; padding: 12px 30px; border-radius: 4px; font-weight: 600; transition: background 0.2s; }
.btn-kb-cancel:hover { background: #5a6268; }

.spreadsheet-meta-link {
    color: #1d6f42; /* Google Sheets Green */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 5px;
    transition: all 0.2s;
}
.spreadsheet-meta-link:hover { text-decoration: underline; color: #138c75; }

.spreadsheet-link-area {
    display: flex;
    gap: 10px;
    align-items: center;
}
.btn-spreadsheet {
    background: #f8f9fa;
    color: #1d6f42;
    border: 1px solid #1d6f42;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-spreadsheet:hover { background: #e6f4ea; }

#quill-editor-kb {
    height: 500px;
    border-radius: 0 0 4px 4px;
}

.kb-form-group { margin-bottom: 25px; }
.kb-form-group label { display: block; font-weight: 600; margin-bottom: 8px; color: #333; }
.kb-form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Knowledge Base List View (docs.php) */
.kb-list-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

table.dataTable.kb-table tbody tr { cursor: pointer; }
table.dataTable.kb-table tbody tr:hover { background: #d4f4ea !important; }

.kb-top-wrapper { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

.btn-kb-new {
    background: #20c997;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-kb-new:hover { background: #138c75; }

.col-kb-title { min-width: 300px; }
.doc-title-cell { 
    font-size: 14px; 
    color: #138c75 !important; 
    font-weight: 500; 
}
.col-kb-author { width: 150px; color: #666; font-size: 13px; }
.col-kb-date { width: 150px; color: #666; font-size: 13px; }
.col-kb-attach { width: 50px; text-align: center; }

/* Sharing UI */
.share-section {
    background: #eefaf6;
    border: 1px solid #20c997;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: none;
}
.share-title { font-weight: 700; color: #138c75; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.share-url-box { 
    display: flex; 
    gap: 10px; 
    background: white; 
    padding: 10px; 
    border-radius: 4px; 
    border: 1px solid #c3e6cb; 
}
.share-url-box input { flex: 1; border: none; font-family: monospace; font-size: 13px; color: #333; outline: none; background: transparent; }
.btn-copy { background: #20c997; color: white; border: none; padding: 5px 15px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600; transition: background 0.2s; }
.btn-copy:hover { background: #138c75; }
.btn-kb-share { background: #17a2b8; color: white; text-decoration: none; padding: 8px 15px; border-radius: 4px; font-weight: 600; transition: background 0.2s; border: none; cursor: pointer; }
.btn-kb-share:hover { background: #138496; }



