/* 
 * AI Recipe Builder Styles
 * Dark theme matching COLA Checker
 */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #1a1a3e;
    --border-color: #2a2a4a;
    --text-primary: #eee;
    --text-secondary: #aaa;
    --text-muted: #666;
    --accent-primary: #f39c12;
    --accent-hover: #e67e22;
    --success: #4ade80;
    --error: #ef4444;
    --warning: #fbbf24;
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Navigation */
.navbar {
    background: var(--bg-secondary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand:hover {
    text-decoration: none;
}

.navbar-brand .logo {
    height: 36px;
    width: auto;
}

.navbar-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: 5px 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-primary);
    text-decoration: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: var(--bg-primary);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
    text-decoration: none;
}

.btn-secondary {
    background: #3a3a5a;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #4a4a6a;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

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

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* App Container - Two Panel Layout */
.app-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 66px);
    overflow: hidden;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-rows: 60% 40%;
    }
    
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .navbar-nav {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Chat Panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: var(--bg-primary);
    height: 100%;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .chat-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-header h2 {
    color: var(--accent-primary);
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.chat-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0; /* Important for flex overflow */
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-bottom-right-radius: 4px;
}

.message.ai {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.message.ai ol,
.message.ai ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message.ai li {
    margin-bottom: 5px;
}

/* Recipe Link in Chat */
.recipe-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 10px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid var(--border-color);
}

.recipe-link:hover {
    background: var(--bg-tertiary);
}

.recipe-link .icon {
    font-size: 1.2rem;
}

.recipe-link .text {
    font-weight: 500;
    color: var(--accent-primary);
}

.recipe-link .expand-icon {
    margin-left: auto;
    color: var(--text-muted);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    border: 1px solid var(--border-color);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Wait Message */
.wait-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.wait-message .icon {
    font-size: 1.3rem;
}

/* Chat Input */
.chat-input-container {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 46px;
    max-height: 120px;
}

#user-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#user-input::placeholder {
    color: var(--text-muted);
}

#send-button {
    min-width: 80px;
    height: 46px;
}

/* Recipe Panel */
.recipe-panel {
    background: var(--bg-secondary);
    overflow-y: auto;
    padding: 0;
    height: 100%;
}

.recipe-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.recipe-placeholder h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.recipe-placeholder p {
    max-width: 400px;
    margin-bottom: 20px;
}

.placeholder-examples {
    text-align: left;
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 10px;
    max-width: 400px;
}

.placeholder-examples p {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.placeholder-examples ul {
    list-style: none;
    padding: 0;
}

.placeholder-examples li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.placeholder-examples li:last-child {
    border-bottom: none;
}

/* Recipe Content */
.recipe-content {
    padding: 20px;
}

/* Print Styles */
@media print {
    .navbar,
    .chat-panel,
    .recipe-actions,
    .affiliate-notice {
        display: none !important;
    }
    
    .app-container {
        display: block;
        height: auto;
    }
    
    .recipe-panel {
        width: 100%;
        padding: 0;
        background: white;
        color: black;
    }
    
    .recipe-card {
        box-shadow: none;
        border: none;
    }
    
    .recipe-section {
        break-inside: avoid;
    }
}
