/* style.css */
/* THIS IS THE COMPLETE CODE FOR THIS FILE - NO OMISSIONS */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    color: #333;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

h1, h3, h4 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #111;
}
h1 {
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 2em 0;
}

form label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: bold;
    font-size: 0.95em;
}

form input[type="text"],
form input[type="password"] {
    width: 95%;
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    max-width: 600px;
}

.tooltip {
    cursor: help;
    border-bottom: 1px dotted #007bff;
    color: #007bff;
    font-weight: normal;
    font-size: 0.9em;
}

input[type="password"] {
    /* Use standard password masking */
}

/* --- Buttons --- */
button {
    padding: 10px 18px;
    margin-top: 10px;
    margin-right: 8px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
    font-size: 1em;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    vertical-align: middle;
}

button:hover:not(:disabled) {
    opacity: 0.9;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

#fetchStructureBtn { background-color: #17a2b8; }
#generateTextBtn { background-color: #28a745; }
#copyBtn { background-color: #6c757d; }
#downloadTxtBtn { background-color: #6f42c1; }
#selectAllBtn, #deselectAllBtn {
    background-color: #ffc107;
    color: #333;
    padding: 6px 12px;
    font-size: 0.9em;
    margin-right: 10px;
}

button i {
    vertical-align: -2px;
    margin-right: 6px;
    display: inline-block;
}

/* --- Status, Error, Spinner --- */
.status {
    margin-top: 15px;
    padding: 10px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-weight: bold;
    color: #495057;
}

.error {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    font-weight: bold;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- File Filter/Selection Area (Tree Styles) --- */
#filterArea {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

#extensionFilters {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
}
#extensionFilters label {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 5px;
    font-weight: normal;
    font-size: 0.9em;
    cursor: pointer;
}
#extensionFilters input[type="checkbox"] {
     margin-right: 5px;
     vertical-align: middle;
}

/* File Tree Container */
.file-tree {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    font-size: 0.95em;
    margin-top: 15px;
}

.file-tree ul {
    list-style-type: none;
    padding-left: 20px; /* Indentation for nested levels */
    margin: 0;
}
.file-tree-root {
     padding-left: 0; /* No indentation for the top level */
}


.file-tree li {
    margin: 1px 0; /* Tighter spacing */
    padding: 1px 0;
    position: relative;
    /* Prevent text selection on the whole LI */
    user-select: none;
   -webkit-user-select: none; /* Safari */
   -moz-user-select: none; /* Firefox */
   -ms-user-select: none; /* IE10+ */
}

/* Node Content Wrapper */
.file-tree .node-content {
    display: flex;
    align-items: center;
    cursor: default;
    padding: 1px 0; /* Minimal vertical padding */
}
.file-tree .node-content label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    /* Allow text selection specifically on the label */
     user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}


/* Toggle Button */
.file-tree .toggle,
.file-tree .toggle-placeholder {
    display: inline-block;
    width: 18px;
    height: 18px;
    text-align: center;
    line-height: 18px; /* Vertically center content */
    cursor: pointer;
    font-size: 0.8em;
    color: #666;
    margin-right: 4px;
    flex-shrink: 0;
    /* background-color: #f0f0f0; */ /* Optional background for toggle */
    /* border-radius: 3px; */
}

/* Toggle icon display using CSS ::before pseudo-element */
.file-tree .toggle.expanded::before {
    content: '▼'; /* Down arrow for expanded state */
}
.file-tree .toggle.collapsed::before {
    content: '▶'; /* Right arrow for collapsed state */
}
.file-tree .toggle.empty::before {
    content: ' '; /* Empty space for toggle with no children */
}

.file-tree .toggle:hover {
    color: #000;
}
.file-tree .toggle-placeholder,
.file-tree .toggle.empty {
    cursor: default;
    color: #ccc; /* Lighter color for empty/placeholder */
}


/* Checkbox */
.file-tree input[type="checkbox"] {
    margin: 0;
    margin-right: 0; /* Label provides spacing */
    vertical-align: middle;
    flex-shrink: 0;
    cursor: pointer;
}
/* Style for indeterminate state (supported by most modern browsers) */
.file-tree input[type="checkbox"]:indeterminate {
    /* background-color: #ccc; */ /* Optional visual cue */
     opacity: 0.7;
}
.file-tree input[type="checkbox"]:disabled {
     cursor: not-allowed;
     opacity: 0.5;
}


/* Node Icon */
.file-tree .node-icon {
    display: inline-block;
    width: 1.3em;
    text-align: center;
    margin-right: 4px;
    font-size: 1em;
}

/* Style for filtered out directories (optional) */
.file-tree li.filtered-out-dir > .node-content {
    opacity: 0.6; /* Make it look faded */
}

/* Placeholder text style */
.placeholder-text {
    color: #888;
    font-style: italic;
    padding: 10px;
    display: block; /* Ensure it takes block space */
}

.tree-actions {
    margin-top: 10px;
}


/* --- Result Preview Area --- */
#resultContainer {
     margin-top: 20px;
     border-top: 1px solid #eee;
     padding-top: 15px;
}
#outputPreview {
    margin-bottom: 15px;
}
#outputPreview label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}
#outputPreview pre {
    max-height: 500px;
    overflow: auto;
    background-color: #fdfdfd;
    border: 1px solid #ddd;
    padding: 15px;
    margin-top: 0;
    margin-bottom: 15px;
    white-space: pre-wrap; /* Wrap long lines in content preview */
    word-wrap: break-word;
    border-radius: 4px;
}
#outputPreview code { /* Shared style for both previews */
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    color: #333;
    display: block;
}

/* Specific styling for the structure preview to ensure text tree format */
#structurePreview {
    white-space: pre; /* CRUCIAL: Preserve whitespace and line breaks for tree */
    overflow-x: auto; /* Allow horizontal scroll if tree is wide */
    border-bottom: 1px dashed #ccc;
    padding-bottom: 10px;
    margin-bottom: 10px;
    color: #444; /* Slightly different color for structure */
    line-height: 1.4; /* Adjust line height for tree readability */
}


#outputActions {
    margin-top: 15px;
}

/* --- Password Protection Styles --- */
#password-container {
    display: flex; /* Used to center the form */
    justify-content: center;
    align-items: center;
    min-height: 80vh; /* Take up most of the viewport height */
    padding: 20px;
}

.auth-form-container {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.auth-form-container h1 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.8em;
    color: #333;
}
.auth-form-container h1 i {
    vertical-align: -3px;
    margin-right: 8px;
    color: #007bff;
}

.auth-form-container p {
    margin-bottom: 20px;
    color: #555;
}

#password-form label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

#password-form input[type="password"] {
    width: calc(100% - 22px); /* Account for padding */
    padding: 12px 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

#password-form button[type="submit"] {
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1em;
    background-color: #007bff;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#password-form button[type="submit"]:hover {
    background-color: #0056b3;
}
#password-form button[type="submit"]:disabled .spinner {
    width: 18px; /* Adjust spinner size in button */
    height: 18px;
    border-width: 2px; /* Thinner border for button spinner */
    margin-right: 10px;
}


#password-error-message {
    margin-top: 15px;
    /* .error class is already defined with red background/text */
}

/* --- App Header for Logout Button --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 1em; /* Add some space below the header */
}

.app-header h1 {
    border-bottom: none; /* Remove duplicate border if h1 already has one */
    margin-bottom: 0.3em; /* Align with original h1 padding */
}

#logoutBtn {
    background-color: #dc3545; /* Red for logout */
    padding: 8px 15px;
    font-size: 0.9em;
    margin-top: 0; /* Align with h1 */
}
#logoutBtn i {
    margin-right: 5px;
}

/* Ensure spinner in button is styled correctly */
#password-submit-btn .spinner {
    border-top-color: #fff; /* White spinner on blue button */
}

/* style.css */

/* Target the form elements within repoForm for better scoping */
#repoForm input[type="text"],
#repoForm input[type="password"],
#repoForm button {
    /* Ensure consistent box model for easier height/padding management */
    box-sizing: border-box;
    /* Set a consistent height for inputs and the button */
    height: 40px; /* Adjust as needed */
    padding: 0.5em 0.75em; /* Adjust padding for aesthetics */
    margin-bottom: 15px; /* Consistent bottom margin */
    vertical-align: middle; /* Helps if they are inline-block and somehow misaligned */
}

/* Specific adjustments for the PAT input */
#repoForm #patInput {
    /* If it's still not aligning, you might need to ensure it's taking up appropriate width
       or is in the same display context as the button if they are meant to be side-by-side.
       Assuming it's block or full width by default based on the image. */
}

/* Specific adjustments for the Fetch button */
#repoForm #fetchStructureBtn {
    /* 1b: Adjust button length - make it fit content or a specific reasonable width */
    width: auto; /* Let content and padding define width */
    /* OR for a fixed width, e.g.:
    width: 250px;
    max-width: 100%; prevent overflow on small screens */

    /* 1c: Change background color to be more low-key */
    background-color: #6c757d; /* A common "secondary" button color (Bootstrap-like gray) */
    /* color: white; /* Ensure text is readable */
    border: 1px solid #6c757d; /* Optional: matching border */
    /* You can also use a lighter gray or a muted version of your primary color */
    /* e.g., background-color: #f0f0f0; color: #333; border: 1px solid #ccc; */
}

#repoForm #fetchStructureBtn:hover {
    background-color: #5a6268; /* Darken slightly on hover */
    border-color: #545b62;
}

/* If the PAT input and Fetch button are meant to be on the same line: */
/* You might need a wrapper div with display: flex */
/* Example HTML:
<div class="form-row-flex">
    <input type="password" id="patInput" ... >
    <button type="button" id="fetchStructureBtn" ... >...</button>
</div>
*/
/* CSS for flex row:
.form-row-flex {
    display: flex;
    align-items: center; /* Vertically align items */
    gap: 10px; /* Space between items */
}
.form-row-flex #patInput {
    flex-grow: 1; /* Input takes available space */
    margin-bottom: 0; /* Remove margin if handled by gap */
}
.form-row-flex #fetchStructureBtn {
    flex-shrink: 0; /* Button doesn't shrink */
    margin-bottom: 0; /* Remove margin if handled by gap */
    width: auto; /* Ensure it's not 100% width from other rules */
}
