/* NCGantt - Nextcloud App CSS
 * All styles are scoped to .app-ncgantt to prevent conflicts
 */

.app-ncgantt {
    /* Main container */
    .gannt_container {
        max-width: 100%;
        margin: 0 3px;
        background: white;
        padding: 20px;
        padding-top: 5px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* Form elements */
    .board-select {
        min-width: 150px;
    }

    .import-export-select {
        width: 57px;
    }

    .board-select, 
    .import-export-select, 
    .import-export-btn {
        height: 22px;
        cursor: pointer;
    }

    .import-export-selection {
        display: none;
    }

    .nobreak {
        white-space: nowrap;
    }

    /* Status section */
    .status-section {
        width: 95%;
        background: #f8f9fa;
        border-radius: 6px;
        margin-bottom: 0px;
        padding: 10px;
        display: flex;
        align-items: center;
        row-gap: 5px;
        column-gap: 10px;
        flex-wrap: wrap;
    }

    .board-selection {
        display: flex;
        align-items: center;
        gap: 5px;
        white-space: nowrap;
    }

    .label {
        display: block;
        margin-bottom: 5px;
        color: #666;
        font-weight: bold;
        white-space: nowrap;
    }

    /* Gantt container */
    #gantt-container {
        margin-top: 10px;
        overflow-x: auto;
    }

    /* Status messages */
    .error {
        background: #fee;
        color: #c33;
        padding: 2px 8px;
        border-radius: 4px;
        height: 22px;
    }

    .success {
        background: #efe;
        color: #363;
        padding: 2px 8px;
        border-radius: 4px;
        height: 22px;
    }

    .loading {
        text-align: center;
        color: #666;
        padding: 2px 8px;
        border-radius: 4px;
        height: 22px;
    }

    /* Stack colors legend */
    .stack-colors {
        margin-top: 5px;
        margin-left: 3px;
        display: flex;
        column-gap: 10px;
        flex-wrap: wrap;
    }

    .stack-indicator {
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .color-box {
        width: 20px;
        height: 13px;
        border-radius: 4px;
        border: 1px solid #ddd;
        font-size: 9px;
        text-align: center;
    }

    /* Labels section */
    .labels-section {
        margin-top: 5px;
        padding-top: 0px;
        border-top: 2px solid #ddd;
    }

    .labels-title {
        font-weight: bold;
    }

    /* HTML popup styles */
    .htmlOutput {
        position: relative;
    }

    .htmlOutput ul, 
    .htmlOutput ol {
        margin: 0.5em 0;
        padding-left: 1.7em;
    }

    .htmlOutput li {
        margin: 0.25em 0;
        padding-left: 0.3em;
    }

    /* Remove bullets from checkbox list items */
    .htmlOutput li:has(input[type="checkbox"]) {
        list-style: none;
        margin-left: -1.5em;
        position: relative;
        padding-left: 1.8em;
    }

    .htmlOutput ul {
        list-style: disc;
    }

    /* Style checkboxes to allow proper text alignment */
    .htmlOutput input[type="checkbox"] {
        position: absolute;
        left: 0;
        top: 0.05em;
        margin: 0;
        margin-left: 0.2em;
        margin-right: 0.5em;
        height: 14px;
        min-height: 14px;
    }

    .htmlOutput p {
        margin: 0;
        margin-top: 1em;
        margin-bottom: 0.5em;
    }

    /* Markdown textarea */
    .md_textarea {
        width: 99.6%;
        font-family: inherit;
        font-size: inherit;
        padding: 2px;
        margin: -3px -2px;
        cursor: text;
        border-radius: 3px;
        border-style: solid;
        border-color: black;
        border-width: 1px;
        outline: none;
        resize: none;
    }

    /* Frappe Gantt customizations */
    .gantt-container {
        margin-bottom: 15px;
        margin-top: 0px;
    }

    .viewmode-select_ {
        margin-top: 10px;
        height: 18.6px;
    }

    .viewmode-select {
        min-width: 100px;
    }

    .upper-text {
        margin-top: 0px;
    }

    .gantt-container .popup-wrapper {
        max-width: 350px;
        min-width: 350px;
        border-radius: 8px;
    }

    .gantt-container .popup-wrapper .title {
        width: 90%;
        line-height: 1.3;
        font-size: 0.9rem;
    }

    .gantt-container .popup-wrapper .subtitle {
        font-size: 0.9rem;
    }

    .gantt-container .popup-wrapper .details {
        font-size: 0.85rem;
    }

    .gantt-container .popup-wrapper hr {
        border: 1px solid #e9e9e9;
    }

    .gantt-container .popup-wrapper .popup-top-line {
        margin-top: 10px;
        margin-bottom: 15px;
    }

    .gantt-container .popup-wrapper .popup-bottom-line {
        margin-top: 15px;
        margin-bottom: 6px;
    }
	
	.gantt .bar-label tspan {
		pointer-events: none;
	}
    /* HTML-MD Toggle */
    .html-md-icon-toggle,
	.md-html-icon-toggle {
        position: absolute;
        top: 4px;
        right: 7px;
        cursor: pointer;
        user-select: none;
        background-image: unset;
        background-color: white;
        padding: 1px 2px;
    }

    .html_box {
        min-height: 1px;
    }

    .popup-close-button {
        position: absolute;
        top: 13px;
        right: 21px;
        cursor: pointer;
    }

    .popup-close-button img {
        height: 0.8rem;
        cursor: pointer;
    }

    .html-md-icon-toggle img, 
    .md-html-icon-toggle img {
        cursor: pointer;
    }

    .html-md-icon-toggle img {
        height: 0.9rem;
    }

    .md-html-icon-toggle img {
        height: 1.1rem;
    }

    /* Mobile responsive design */
    @media (max-width: 768px) {
        #status {
            display: none;
        }

        .gannt_container {
            padding: 0px;
        }

        .gantt-container .popup-wrapper {
            position: fixed !important;
            top: 52px !important;
            left: 5px !important;
            width: 92vw !important;
            height: 90vh !important;
            background-color: white !important;
            z-index: 9999 !important;
            overflow: auto !important;
            padding: 15px;
            margin: 9px;
            border-radius: 8px;
            box-sizing: border-box;
            max-width: none;
			min-width: unset;
            box-shadow: 0px 0px 127px #0000009c;
        }

        .gantt-container .popup-wrapper:before {
            content: "Task Details";
            display: block;
            font-size: 1.2rem;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .gantt-container .popup-wrapper .title {
            margin-top: 17px;
            font-size: 1rem;
        }

        .gantt-container .popup-wrapper .subtitle {
            font-size: 1rem;
        }

        .gantt-container .popup-wrapper .details {
            font-size: 0.9rem;
        }

        .gantt-container .html_box {
            line-height: 1.1;
			padding-top: 1px;
		}
		
		.gantt-container .md_textarea {
			padding-top: 7px;
		}
		
		.htmlOutput input[type="checkbox"] {
			margin-top: 2px;
		}
		
		.popup-close-button img {
			height: 1rem;
		}
    }

    @media (max-width: 550px) {
        .import-export-selection {
            display: unset;
		}
        .import-export-select {
			-webkit-appearance: none;
			-moz-appearance: none;
			appearance: none;
			background: transparent; 
			border: none;
			font-size: 1.3rem;
			width: 1.5em;
        }

        .import-export-buttons {
            display: none;
        }
    }
}

/* Focus styles for accessibility */
/* .app-ncgantt {
    button:focus,
    select:focus,
    input:focus,
    textarea:focus {
        outline: 2px solid #305e92;
        outline-offset: 0px;
    }
}
 */
/* Print styles */
@media print {
    .app-ncgantt {
        .status-section,
        .settings-container,
        .import-export-buttons,
        .import-export-selection {
            display: none !important;
        }

        .gantt-container {
            overflow: visible !important;
        }
    }
}