/**
 * Interactive Canvas Styles - Optimized for Google Nest Hub
 * Also supports regular web browser viewing
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Browser Mode Styles */
.browser-mode {
    background: white;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem;
}

/* Status Messages */
.status-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

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

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

.status-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Spinner Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* Category Cards */
.categories-view {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
}

.category-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: #4a90e2;
}

.category-card-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.category-card-content {
    padding: 1.5rem;
    text-align: center;
}

.category-card-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.category-card-count {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.browser-header {
    max-width: 1200px;
    margin: 0 auto 2rem;
    text-align: center;
}

.browser-header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 1.5rem;
}

.search-box {
    display: flex;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.search-box input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
}

.search-box button {
    padding: 1rem 2rem;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.category-btn {
    padding: 0.5rem 1.25rem;
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.category-btn:hover {
    background: #e9ecef;
    border-color: #4a90e2;
    transform: translateY(-2px);
}

.category-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.recipe-list {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.recipe-card-browser {
    background: white !important;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s;
    border-width: 2px !important;
    border-style: solid !important;
    border-color: #adb5bd !important;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
}

.recipe-card-browser:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.recipe-card-browser img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.recipe-card-content {
    padding: 1.5rem;
}

.recipe-card-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.recipe-card-content .badge {
    display: inline-block;
    background: #4a90e2;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.browser-recipe-view {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 12px;
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 2rem;
}

.browser-recipe-view h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.browser-recipe-view .recipe-image {
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    border-radius: 12px;
    overflow: hidden;
}

.browser-recipe-view .recipe-image img {
    width: 100%;
    height: auto;
    display: block;
}

.browser-recipe-view .section {
    margin: 2rem 0;
}

.browser-recipe-view .section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #4a90e2;
    padding-bottom: 0.5rem;
}

.browser-recipe-view .ingredients-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

.browser-recipe-view .ingredients-list li {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.browser-recipe-view .ingredients-list li.checked {
    background: #e7f3ff;
    border-left-color: #28a745;
    opacity: 0.7;
}

.browser-recipe-view .ingredient-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #4a90e2;
    display: block !important;
}

.browser-recipe-view .ingredient-label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    user-select: none;
    line-height: 1.6;
}

.browser-recipe-view .ingredients-list li.checked .ingredient-label {
    text-decoration: line-through;
    color: #6c757d;
}

.browser-recipe-view .instructions-list {
    list-style: none;
    padding: 0;
}

.browser-recipe-view .instructions-list .step-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    border-left: 4px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s;
    cursor: pointer;
}

.browser-recipe-view .instructions-list .step-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.browser-recipe-view .instructions-list .step-item.checked {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    opacity: 0.8;
}

.browser-recipe-view .instructions-list .step-item .step-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.browser-recipe-view .instructions-list .step-item .step-label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    user-select: none;
    line-height: 1.6;
}

.browser-recipe-view .instructions-list .step-item.checked .step-label {
    text-decoration: line-through;
    opacity: 0.8;
}

/* Screen States */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 2rem;
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

/* Loading Screen */
#loading {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Recipe Screen */
#recipe-screen {
    background: white;
}

.recipe-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
}

#recipe-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.recipe-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 1.1rem;
    color: #6c757d;
}

.recipe-meta .badge {
    background: #4a90e2;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
}

.recipe-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
}

/* Recipe Image */
.recipe-image-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 2rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#recipe-image {
    width: 100%;
    height: auto;
    display: block;
}

.recipe-image-container:empty {
    display: none;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #4a90e2;
}

/* Ingredients */
.ingredients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.scaling-controls,
.browser-recipe-view .scaling-controls {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.scaling-controls input,
.browser-recipe-view .scaling-controls input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.scaling-controls button,
.browser-recipe-view .scaling-controls button {
    padding: 0.5rem 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.scaling-controls button:hover,
.browser-recipe-view .scaling-controls button:hover {
    background: #5a6268;
}

.scaling-controls label {
    font-weight: 500;
    margin: 0;
}

.scaling-controls input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
}

.scaling-controls .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.scaling-controls .btn-sm:hover {
    background: #5a6268;
}

.ingredients-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

.ingredients-list li {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
    font-size: 1.1rem;
    line-height: 1.6;
    transition: all 0.3s;
}

.ingredient-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.ingredient-item.checked {
    background: #e7f3ff;
    border-left-color: #28a745;
    opacity: 0.7;
}

.ingredient-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #4a90e2;
    display: block !important;
}

.ingredient-label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.ingredient-item.checked .ingredient-label {
    text-decoration: line-through;
    color: #6c757d;
}

/* Instructions */
.current-step {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.current-step.checked {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    opacity: 0.8;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.step-number {
    font-size: 1.25rem;
    font-weight: 600;
    opacity: 0.9;
}

.step-checkbox {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #28a745;
    display: block !important;
}

#step-text {
    font-size: 1.5rem;
    line-height: 1.8;
    font-weight: 400;
}

.current-step.checked #step-text {
    text-decoration: line-through;
    opacity: 0.8;
}

.step-progress {
    text-align: center;
    color: #6c757d;
    font-size: 1rem;
    margin-top: 1rem;
    font-weight: 500;
}

/* All Steps List (for desktop/mobile) */
.all-steps-list {
    margin-top: 2rem;
}

.all-steps-list h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
    transition: all 0.3s;
    cursor: pointer;
}

.step-item:hover {
    background: #e9ecef;
}

.step-item.checked {
    background: #e7f3ff;
    border-left-color: #28a745;
    opacity: 0.7;
}

.step-item .step-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
}

.step-item .step-label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    user-select: none;
    line-height: 1.6;
}

.step-item.checked .step-label {
    text-decoration: line-through;
    color: #6c757d;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 0;
    border-top: 2px solid #e9ecef;
    margin-top: auto;
}

.btn {
    flex: 1;
    padding: 1.25rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    touch-action: manipulation;
}

.btn-primary {
    background: #4a90e2;
    color: white;
}

.btn-primary:hover:not(:disabled),
.btn-primary:active:not(:disabled) {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.btn-secondary:hover:not(:disabled),
.btn-secondary:active:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn span {
    font-size: 1.25rem;
}

/* Voice Hint */
.voice-hint {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 1rem;
}

.voice-hint p {
    color: #6c757d;
    font-size: 0.95rem;
    font-style: italic;
}

/* Error Screen */
#error-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.error-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-content p {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Responsive adjustments for Nest Hub */
@media (orientation: landscape) {
    .recipe-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    #ingredients-section {
        grid-column: 1;
    }

    #instructions-section {
        grid-column: 2;
    }
    
    .all-steps-list {
        display: none; /* Hide on Hub landscape */
    }
}

/* Touch-friendly sizing */
@media (pointer: coarse) {
    .btn {
        min-height: 60px;
        font-size: 1.2rem;
    }
    
    .ingredient-checkbox,
    .step-checkbox {
        width: 24px;
        height: 24px;
    }
}

/* Desktop/Tablet optimizations */
@media (min-width: 768px) and (min-height: 600px) {
    .all-steps-list {
        display: block;
    }
    
    #recipe-screen {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .recipe-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    #ingredients-section {
        grid-column: 1;
    }
    
    #instructions-section {
        grid-column: 2;
    }
}

/* Mobile optimizations */
@media (max-width: 767px) {
    .recipe-header h1 {
        font-size: 1.75rem;
    }
    
    .recipe-content {
        display: block;
    }
    
    .ingredients-list {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .controls .btn {
        width: 100%;
    }
    
    .scaling-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .scaling-controls input {
        width: 100%;
    }
    
    .all-steps-list {
        display: block;
    }
    
    .step-item {
        padding: 1rem;
    }
}

/* Google Home Hub specific (square screen) */
@media (min-width: 600px) and (min-height: 600px) and (max-width: 1024px) {
    .all-steps-list {
        display: none; /* Hide on Hub for cleaner view */
    }
    
    .current-step {
        font-size: 1.3rem;
    }
    
    #step-text {
        font-size: 1.4rem;
    }
}

/* Timer Overlay - Full Screen */
.timer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.timer-content {
    text-align: center;
    color: white;
}

.timer-display {
    margin-bottom: 3rem;
}

.timer-time {
    font-size: 8rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
    color: white;
}

.timer-label {
    font-size: 1.5rem;
    opacity: 0.9;
    max-width: 80%;
    margin: 0 auto;
}

.timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.timer-controls .btn {
    min-width: 150px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Timer Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes flash {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes flash-bg {
    0%, 100% {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    50% {
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    }
}

/* Timer button in steps */
.timer-btn,
.browser-timer-btn {
    transition: all 0.3s;
}

.timer-btn:hover,
.browser-timer-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

/* Mobile timer adjustments */
@media (max-width: 767px) {
    .timer-time {
        font-size: 5rem;
    }
    
    .timer-label {
        font-size: 1.2rem;
    }
    
    .timer-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .timer-controls .btn {
        width: 100%;
    }
}

