/* Goal Setter Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Form Section */
.goal-form-section {
    padding: 30px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.goal-form-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.form-group input,
.form-group select {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

#goal-title {
    flex: 1;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

#goal-title:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

#add-goal-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

#add-goal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

/* Goals Section */
.goals-section {
    padding: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 1.5em;
    margin: 0;
}

.section-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.goal-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.control-btn.toggle-completed {
    background: #2196F3;
    color: white;
}

.control-btn.toggle-completed:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.control-btn.delete-completed {
    background: #f44336;
    color: white;
}

.control-btn.delete-completed:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

.stats {
    color: #666;
    font-size: 0.9em;
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

.goals-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Goal Item */
.goal-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.goal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.goal-item.completed {
    background: linear-gradient(135deg, #e8f5e8, #f1f8e9);
    border-left: 4px solid #4CAF50;
}

.goal-item.completed::before {
    content: '✓';
    position: absolute;
    top: 15px;
    right: 15px;
    background: #4CAF50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.goal-title {
    flex: 1;
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.4;
}

.goal-title.completed {
    text-decoration: line-through;
    color: #666;
}

.goal-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.goal-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.goal-btn.add-subgoal {
    background: #FF9800;
    color: white;
    padding: 6px 8px;
    font-size: 1em;
}

.goal-btn.add-subgoal:hover {
    background: #F57C00;
    transform: translateY(-1px);
}

/* Add Top-Level Goal Button */
.add-top-level-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    display: block;
    margin: 20px auto 0;
    min-width: 200px;
}

.add-top-level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.add-goal-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* Progress Controls Row */
.progress-controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.progress-controls-row .progress-slider {
    flex: 1;
    margin-top: 0;
}

.complete-btn-small {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.complete-btn-small:hover {
    background: #388E3C;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.goal-btn.edit {
    background: #2196F3;
    color: white;
}

.goal-btn.edit:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.goal-btn.delete {
    background: #f44336;
    color: white;
}

.goal-btn.delete:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

.goal-btn.complete {
    background: #4CAF50;
    color: white;
}

.goal-btn.complete:hover {
    background: #388E3C;
    transform: translateY(-1px);
}

/* Progress Bar */
.progress-container {
    margin-bottom: 15px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #666;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.3), transparent);
    border-radius: 6px;
}

.progress-text {
    font-weight: bold;
    color: #2c3e50;
}

/* Goal Metadata */
.goal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: #888;
    margin-top: 10px;
}

.goal-date {
    font-style: italic;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #999;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Motivation Section */
.motivation-section {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 30px;
    text-align: center;
}

.motivation-section h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.motivation-section p {
    font-style: italic;
    opacity: 0.9;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    animation: modalSlideIn 0.3s ease-out;
}

.small-modal {
    max-width: 350px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #666;
}

.modal-body {
    padding: 25px;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 15px;
}

.modal-body input:focus {
    outline: none;
    border-color: #4facfe;
}

.progress-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

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

.progress-controls input {
    width: 80px;
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#save-edit-btn {
    background: #4CAF50;
    color: white;
}

#save-edit-btn:hover {
    background: #388E3C;
}

#cancel-edit-btn {
    background: #f44336;
    color: white;
}

#cancel-edit-btn:hover {
    background: #d32f2f;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.goal-item {
    animation: fadeInUp 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .goal-form-section,
    .goals-section {
        padding: 20px;
    }

    .form-group {
        flex-direction: column;
        align-items: stretch;
    }

    #add-goal-btn {
        align-self: flex-start;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .goal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .goal-actions {
        align-self: flex-end;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .progress-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .progress-controls input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8em;
    }

    .goal-item {
        padding: 15px;
    }

    .goal-btn {
        padding: 5px 10px;
        font-size: 0.8em;
    }
}
