/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

/* Navigation */
.navbar {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
}

.logo:hover {
    color: var(--primary-color);
}

.navbar-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-small {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.back-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    color: var(--primary-color);
}

.project-description {
    color: var(--text-light);
    font-size: 0.9375rem;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.project-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
}

.project-card-header {
    padding: 1.5rem 1.5rem 0.75rem;
}

.project-card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0;
}

.project-card-header a {
    color: var(--text-dark);
    text-decoration: none;
}

.project-card-header a:hover {
    color: var(--primary-color);
}

.project-card-body {
    padding: 0 1.5rem 1.5rem;
}

.project-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
}

/* Progress Bar */
.progress-section {
    margin-top: 1rem;
}

.progress-section-large {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.progress-percentage {
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    height: 8px;
    background-color: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
}

.progress-section-large .progress-bar {
    height: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.empty-state-small {
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    background-color: var(--bg-light);
    border-radius: var(--radius);
}

/* Sort Controls */
.sort-controls {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.sort-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.sort-form label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
}

.sort-form select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sort-form select:hover {
    border-color: var(--primary-color);
}

.sort-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Forms */
.form-container {
    max-width: 600px;
}

.project-form {
    background-color: var(--bg-white);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.add-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.add-form input {
    flex: 1;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
}

.add-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Milestones */
.milestones-section {
    background-color: var(--bg-white);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.milestones-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.milestone-card {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.2s;
}

.milestone-card.completed {
    opacity: 0.7;
}

.milestone-header {
    margin-bottom: 1rem;
}

.milestone-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.milestone-title h3 {
    font-size: 1.125rem;
    font-weight: 600;
    flex: 1;
}

.milestone-card.completed h3 {
    text-decoration: line-through;
}

.task-count-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 999px;
}

/* Checkboxes */
.checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox:hover {
    border-color: var(--primary-color);
}

.checkbox.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.checkbox:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--border-color);
}

.checkbox:disabled:hover {
    border-color: var(--border-color);
}

.checkbox-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.checkbox-small:hover {
    border-color: var(--primary-color);
}

.checkbox-small.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

/* Tasks */
.tasks-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.add-task-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-task-form input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.add-task-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.tasks-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border-radius: var(--radius);
}

.task-item.completed .task-name {
    text-decoration: line-through;
    opacity: 0.6;
}

.task-name {
    font-size: 0.875rem;
}

/* Inline Editing */
.editable-project,
.editable-milestone,
.editable-task {
    position: relative;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.editable-project:hover,
.editable-milestone:hover,
.editable-task:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.edit-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.875em;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.editable-project:hover .edit-icon,
.editable-milestone:hover .edit-icon,
.editable-task:hover .edit-icon {
    opacity: 1;
}

.inline-edit-input {
    width: 100%;
    padding: 4px 8px;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    outline: none;
    background-color: white;
}

.view-link {
    margin-left: 0.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.25rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.view-link:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Login Page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
}

.login-card {
    background-color: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.9375rem;
}

.login-form {
    margin-bottom: 1.5rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .form-group:last-of-type {
    margin-bottom: 1.75rem;
}

.btn-full {
    width: 100%;
    padding: 0.75rem;
}

.login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-light);
    font-size: 0.8125rem;
}

.login-card .alert {
    margin-bottom: 1.5rem;
}

/* Drag and Drop */
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    cursor: grab;
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
    flex-shrink: 0;
}

.drag-handle:hover {
    opacity: 1;
    color: var(--primary-color);
}

.drag-handle:active {
    cursor: grabbing;
}

.milestone-card.dragging,
.task-item.dragging {
    opacity: 0.5;
    background-color: var(--bg-light);
}

.milestone-card[draggable="true"],
.task-item[draggable="true"] {
    cursor: move;
}

/* Responsive */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
}
