* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    padding: 2rem 1rem;
}

.app {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

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

.add-habit {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    align-items: center;
}

.add-habit input, 
.add-habit select {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

#habit-name {
    flex: 2;
    min-width: 200px;
}

#habit-target {
    flex: 0.5;
    min-width: 80px;
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s, background 0.2s;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: 100%;
}

.habit-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    border-left: 4px solid #667eea;
    transition: transform 0.2s, box-shadow 0.2s;
}

.habit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

.habit-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.habit-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.progress-bar {
    background: #e0e0e0;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 5px;
}

.habit-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.habit-count {
    font-size: 1.5rem;
    font-weight: bold;
}

.habit-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, opacity 0.2s;
    font-size: 1rem;
}

.btn-small:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

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

.btn-add {
    color: white;
    transition: background 0.3s;
}

.streak {
    display: inline-block;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.delete-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.delete-btn:hover {
    color: #f44336;
}

.stats-section {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.stats-section h2 {
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
}

footer {
    text-align: center;
}

.btn-danger {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 1rem;
}

.btn-danger:hover {
    opacity: 1;
}

.empty-state {
    text-align: center;
    color: white;
    padding: 3rem;
    opacity: 0.8;
    grid-column: 1 / -1;
}

.empty-state h2 {
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .add-habit {
        flex-direction: column;
    }
    
    .add-habit input,
    .add-habit select {
        width: 100%;
    }
    
    .habits-grid {
        grid-template-columns: 1fr;
    }
}
