/* CSS Variables */
:root {
    --primary: #2563eb;
    --secondary: #f7f9fc;
    --thirdary: #6b7280;
    --text-color: #111827;
    --button-color: #2563eb;
    --success-color: #16a34a;
    --error-color: #ef4444;
    --border-color: #e5e7eb;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.12);
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.25);
    --footer-height: 64px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif;
    color: var(--text-color);
    background-color: var(--secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: rgb(255, 255, 255);
    padding: 3rem 0;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.header .container {
    position: relative;
    z-index: 1;
}

.header h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.1;
}

#subtitle {
    font-size: 1.5rem;
    color: #d6d6d6;
    opacity: 0.95;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: -10px auto;
    line-height: 1.4;
}

/* Main Content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
    padding-bottom: calc(env(safe-area-inset-bottom) + var(--footer-height) + 1rem);
}

/* Two Column Layout */
.main-content-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Section Styles */
.recipe-input-section,
.recipe-display-section,
.extracted-recipe-section,
.instructions-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.recipe-input-section:hover,
.recipe-display-section:hover,
.extracted-recipe-section:hover,
.instructions-section:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

h2 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Form Styles */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    font-family: inherit;
    background-color: #ffffff;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: var(--thirdary);
    opacity: 0.7;
}

.input-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--thirdary);
    font-size: 0.9rem;
}





/* Button Styles */
.btn-primary,
.btn-secondary {
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--primary);
    color: white;
    margin: 0 0.5rem;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    background-color: #000000;
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-print:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Recipe Display */
.recipe-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.recipe-column {
    background: var(--secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.ingredients-list,
.instructions-list {
    list-style: none;
    padding-left: 0;
}

.ingredients-list li {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    border-radius: 6px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.ingredients-list li:hover {
    background-color: rgba(37, 99, 235, 0.06);
    padding-left: 0.75rem;
}

.instructions-list li {
    margin-bottom: 0.8rem;
    padding-left: 0.25rem;
    position: relative;
}

.instructions-list li::before {
    content: none;
}

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

/* Footer */
.footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    width: 100%;
    background-color: rgba(17, 24, 39, 0.92);
    color: #ffffff;
    text-align: center;
    padding: 0 16px;
    min-height: calc(var(--footer-height) + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: saturate(160%) blur(8px);
}

.footer p {
    margin: 0;
}

.footer a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

.footer-support {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-support iframe {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 2rem 0;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .main-content-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .recipe-input-section,
    .recipe-display-section,
    .extracted-recipe-section,
    .instructions-section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .recipe-comparison {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-secondary {
        margin: 0;
    }
    

}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 0;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .recipe-input-section,
    .recipe-display-section,
    .extracted-recipe-section,
    .instructions-section {
        padding: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    .input-group input,
    .input-group textarea {
        padding: 10px;
        font-size: 0.9rem;
    }
    

}

/* Print Styles */
@media print {
    .header,
    .footer,
    .recipe-input-section,
    .btn-print,
    .btn-secondary,
    .btn-primary,
    .input-group,
    .extraction-instructions {
        display: none !important;
    }

    .main {
        padding: 0;
        margin: 0;
    }

    .extracted-recipe-section {
        box-shadow: none;
        border: none;
        padding: 0;
        margin: 0;
        background: white;
    }

    .recipe-header {
        border-bottom: 2px solid #333;
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }

    .recipe-header h2 {
        font-size: 2rem;
        color: #333;
        margin: 0;
    }

    .extracted-content {
        display: block;
        margin-top: 2rem;
    }

    .extracted-ingredients,
    .extracted-instructions {
        margin-bottom: 2rem;
        page-break-inside: avoid;
    }

    .extracted-ingredients h4,
    .extracted-instructions h4 {
        font-size: 1.5rem;
        color: #333;
        border-bottom: 1px solid #333;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }

    .ingredients-preview ul,
    .instructions-preview ol {
        margin: 0;
        padding-left: 1.5rem;
    }

    .ingredients-preview li,
    .instructions-preview li {
        margin-bottom: 0.5rem;
        line-height: 1.6;
        font-size: 1rem;
    }

    .step-number {
        font-weight: bold;
        margin-right: 0.5rem;
    }

    /* Print header with recipe title */
    .print-recipe-title {
        font-size: 2.5rem;
        font-weight: bold;
        text-align: center;
        margin-bottom: 2rem;
        color: #333;
        border-bottom: 3px solid #333;
        padding-bottom: 1rem;
    }

    /* Ensure good page breaks */
    .extracted-ingredients {
        page-break-after: auto;
    }

    .extracted-instructions {
        page-break-before: auto;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Extraction Instructions */
.extraction-instructions {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: var(--shadow);
}

.extraction-instructions h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.extraction-instructions ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.extraction-instructions li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.extraction-instructions a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.extraction-instructions a:hover {
    text-decoration: underline;
}

.extraction-instructions p {
    margin: 1rem 0;
    font-style: italic;
    color: var(--text-color);
}

.extraction-instructions button {
    margin-top: 1rem;
}

/* Extracted Recipe Display */
.extracted-recipe-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.recipe-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.btn-print {
    background: var(--button-color);
    color: white;
    border: 1px solid transparent;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow);
}

.btn-print:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-print:active {
    transform: translateY(0);
}

.print-icon {
    font-size: 1.2rem;
}

.extracted-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.extracted-ingredients,
.extracted-instructions {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
}

.extracted-ingredients h4,
.extracted-instructions h4 {
    color: var(--primary);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.ingredients-preview,
.instructions-preview {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.ingredients-preview li,
.instructions-preview li {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    line-height: 1.5;
}

.ingredients-preview li:last-child,
.instructions-preview li:last-child {
    border-bottom: none;
}

.instructions-preview li {
    padding-left: 0.5rem;
}

.step-number {
    color: var(--primary);
    font-weight: 700;
    margin-right: 0.5rem;
    width: 1.25rem;
    display: inline-block;
}

/* Responsive design for extracted recipe */
@media (max-width: 768px) {
    .extracted-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .extracted-recipe-section {
        padding: 1rem;
        margin: 1rem 0;
    }
} 