/* --- General & Layout --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f7f7f7;
    color: #333;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden; /* Important for border-radius */
}

header {
    padding: 20px 25px 0;
    background-color: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

h1 {
    color: #333;
    text-align: center;
    font-size: 1.8em;
    margin: 0 0 20px;
    padding-right: 80px; /* Make room for logout button */
}

/* --- Tab System --- */
.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-left: -25px; /* Extend to edge of header padding */
    margin-right: -25px;
    padding: 0 25px;
}

.tab-link {
    padding: 10px 18px;
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1em;
    color: #666;
    margin-bottom: -2px; /* Overlap the container border */
    transition: all 0.2s ease-in-out;
}

.tab-link:hover {
    color: #007bff;
    background-color: #f0f0f0;
}

.tab-link.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 600;
}

.tab-content {
    display: none;
    padding: 15px 25px;
}

.tab-content.active {
    display: block;
}

/* --- Filter & Sort Controls --- */
.controls-container {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

.controls-container form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls-container label {
    font-weight: 500;
    color: #555;
}

.controls-container select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    background-color: #fff;
}

.reset-link {
    margin-left: auto;
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
}
.reset-link:hover {
    text-decoration: underline;
}

/* --- Shared Styles --- */
.section-toggle {
    display: inline-block;
    width: 25px;
    text-align: center;
    font-weight: bold;
    color: #007bff;
    font-size: 1.2em;
    flex-shrink: 0;
}

.section-title {
    flex-grow: 1;
}

.section-content {
    padding-left: 15px;
}

.section-content.hidden {
    display: none;
}

.no-tasks-msg {
    color: #888;
    padding-left: 20px;
    font-style: italic;
}

/* --- Login Page Styles --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

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

.login-container h1 {
    margin: 0 0 20px 0;
    padding: 0;  /* Override the global h1 padding-right */
    text-align: center;
    color: #333;
}

.login-prompt {
    margin-bottom: 20px;
    color: #666;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-container input[type="password"] {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
}

.login-container button {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background-color: #007bff;
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-container button:hover {
    background-color: #0056b3;
}

.error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

/* --- Logout Link Style --- */
.logout-link {
    position: absolute;
    top: 25px;
    right: 25px;
    color: #666;
    text-decoration: none;
    font-size: 0.9em;
}

.logout-link:hover {
    color: #007bff;
}

/* --- Admin Link Style --- */
.admin-link {
    position: absolute;
    top: 25px;
    right: 80px;
    color: #666;
    text-decoration: none;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

.admin-link:hover {
    color: #007bff;
    transform: rotate(90deg);
}

header {
    position: relative; /* Needed for positioning the logout and admin links */
}

/* --- Hide Completed Toggle Button --- */
.toggle-completed-btn {
    display: inline-block;
    padding: 8px 14px;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid #28a745;
    background-color: #fff;
    color: #28a745;
}

.toggle-completed-btn:hover {
    background-color: #f8f9fa;
    border-color: #218838;
}

.toggle-completed-btn.active {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.toggle-completed-btn.active:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* --- Key Project Links Styles --- */
.project-links-header {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.edit-btn {
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-btn {
    background-color: #007bff;
    color: white;
}

.edit-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.save-btn {
    background-color: #28a745;
    color: white;
}

.save-btn:hover {
    background-color: #218838;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.cancel-btn {
    background-color: #6c757d;
    color: white;
}

.cancel-btn:hover {
    background-color: #5a6268;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.project-links-content {
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    min-height: 400px;
}

.project-links-content h2 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.project-links-content h3 {
    color: #555;
    margin-top: 15px;
    margin-bottom: 8px;
}

.project-links-content ul {
    margin-left: 20px;
}

.project-links-content a {
    color: #007bff;
    text-decoration: none;
}

.project-links-content a:hover {
    text-decoration: underline;
}

/* --- Quill Editor Specific Styles --- */
#editor-container {
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
}

#quill-editor {
    min-height: 400px;
    background-color: white;
}

.ql-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
}

.ql-editor {
    min-height: 400px;
}

.ql-toolbar {
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

/* --- Table View Styles --- */
.table-section-container {
    margin-bottom: 30px;
}

.table-section-header {
    margin-top: 20px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    color: #333;
    font-size: 1.3em;
    font-weight: 600;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-section-header.collapsible {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.table-section-header.collapsible:hover {
    background-color: #e9ecef;
}

.tasks-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.tasks-table thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.tasks-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tasks-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.tasks-table tbody tr:hover {
    background-color: #f8f9fa;
}

.tasks-table tbody tr:last-child {
    border-bottom: none;
}

.tasks-table td {
    padding: 12px 15px;
    color: #333;
    font-size: 0.95em;
}

/* Column widths */
.task-col {
    width: 45%;
}

.assignee-col {
    width: 20%;
}

.date-col {
    width: 15%;
}

.status-col {
    width: 20%;
}

/* Task cell with indentation for subtasks */
.task-cell {
    font-weight: 500;
}

.indent-level-0 {
    padding-left: 0;
}

.indent-level-1 {
    padding-left: 20px;
    font-weight: 400;
}

.indent-level-1::before {
    content: "↳ ";
    color: #999;
    margin-right: 5px;
}

.indent-level-2 {
    padding-left: 40px;
    font-weight: 400;
}

.indent-level-2::before {
    content: "↳ ";
    color: #999;
    margin-right: 5px;
}

.indent-level-3 {
    padding-left: 60px;
    font-weight: 400;
}

.indent-level-3::before {
    content: "↳ ";
    color: #999;
    margin-right: 5px;
}

/* Assignee cell */
.assignee-cell {
    color: #495057;
}

.unassigned-text {
    color: #adb5bd;
    font-style: italic;
}

/* Date cell */
.date-cell {
    color: #495057;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.no-date-text {
    color: #adb5bd;
}

/* Status badges in table */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    text-align: center;
}

.status-badge.completed {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Completed row styling */
.completed-row {
    opacity: 0.7;
}

.completed-row .task-cell {
    text-decoration: line-through;
    color: #6c757d;
}

/* Responsive adjustments for table */
@media (max-width: 768px) {
    .tasks-table {
        font-size: 0.85em;
    }

    .tasks-table th,
    .tasks-table td {
        padding: 8px 10px;
    }

    .task-col {
        width: 40%;
    }

    .assignee-col {
        width: 25%;
    }

    .date-col {
        width: 15%;
    }

    .status-col {
        width: 20%;
    }
}

/* --- Admin Panel Styles --- */
.admin-panel {
    padding: 20px 0;
}

.admin-panel > h2 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #007bff;
}

.admin-panel-page {
    padding: 25px;
}

.admin-section {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.admin-section h3 {
    color: #495057;
    font-size: 1.3em;
    margin-top: 0;
    margin-bottom: 10px;
}

.section-description {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 20px;
    font-style: italic;
}

.admin-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95em;
    background-color: #fff;
    transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.admin-btn {
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #007bff;
    color: white;
    margin-top: 10px;
}

.admin-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.admin-btn.refresh-btn {
    background-color: #28a745;
}

.admin-btn.refresh-btn:hover {
    background-color: #218838;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.project-links-preview {
    margin-top: 15px;
    padding: 15px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    min-height: 200px;
}
