/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.app {
    max-width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.wake-lock-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.wake-lock-btn:hover {
    background: rgba(255,255,255,0.3);
}

.wake-lock-btn.active {
    background: rgba(255,255,255,0.9);
    color: #4CAF50;
}

.add-btn {
    background: rgba(255,255,255,0.9);
    color: #4CAF50;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.add-btn:hover {
    background: white;
    transform: translateY(-1px);
}

/* Views */
.view {
    display: none;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.view.active {
    display: block;
}

/* Search */
.search-container {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Recipe Grid */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.recipe-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.recipe-card-content {
    padding: 1.5rem;
}

.recipe-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.recipe-card p {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #666;
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Recipe Detail */
.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.back-btn {
    background: #f1f3f4;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #5f6368;
    transition: background-color 0.2s ease;
}

.back-btn:hover {
    background: #e8eaed;
}

.recipe-actions {
    display: flex;
    gap: 0.5rem;
}

.edit-btn, .delete-btn {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.edit-btn {
    background: #4CAF50;
    color: white;
}

.edit-btn:hover {
    background: #45a049;
}

.delete-btn {
    background: #f44336;
    color: white;
}

.delete-btn:hover {
    background: #da190b;
}

.recipe-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.recipe-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.recipe-description {
    font-size: 1.125rem;
    color: #666;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.recipe-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.info-item {
    text-align: center;
}

.info-label {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #4CAF50;
}

.recipe-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ingredients-list {
    list-style: none;
    padding: 0;
}

.ingredient-item {
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ingredient-item::before {
    content: "✓";
    color: #4CAF50;
    font-weight: bold;
    font-size: 1.2rem;
}

.steps-list {
    list-style: none;
    padding: 0;
}

.step-item {
    padding: 1.5rem;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-number {
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-text {
    font-size: 1rem;
    line-height: 1.6;
}

/* Forms */
.form-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.form-header h2 {
    color: #2c3e50;
    font-size: 1.5rem;
}

.recipe-form {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

.ingredients-container,
.steps-container {
    margin-bottom: 1rem;
}

.ingredient-item,
.step-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: flex-start;
}

.ingredient-input,
.step-input {
    flex: 1;
}

.step-item {
    align-items: flex-start;
}

.step-number {
    width: 2rem;
    height: 2rem;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 0.75rem;
}

.remove-ingredient,
.remove-step {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background-color 0.2s ease;
    margin-top: 0.75rem;
}

.remove-ingredient:hover,
.remove-step:hover {
    background: #da190b;
}

.add-item-btn {
    background: #e8f5e8;
    color: #4CAF50;
    border: 2px dashed #4CAF50;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    width: 100%;
}

.add-item-btn:hover {
    background: #4CAF50;
    color: white;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.save-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.save-btn:hover {
    background: #45a049;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .header-controls {
        gap: 0.5rem;
    }
    
    .wake-lock-text {
        display: none;
    }
    
    .recipe-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .recipe-content {
        padding: 1.5rem;
    }
    
    .recipe-title {
        font-size: 1.5rem;
    }
    
    .recipe-info {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .recipe-form {
        padding: 1.5rem;
    }
    
    .view {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .header-controls {
        justify-content: space-between;
    }
    
    .recipe-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .recipe-actions {
        justify-content: flex-end;
    }
    
    .form-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .form-actions {
        justify-content: stretch;
    }
    
    .save-btn {
        width: 100%;
    }
}
