/* --- Root Variables (Default Dark) --- */
:root {
    --bg-dark: #121212;
    --card-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --accent-purple: #bb86fc;
    --accent-teal: #03dac6;
    --error-red: #ef4444;
    --border: #2c2c2c;
    --text-secondary: #a0a0a0;
}

/* --- Light Mode Overrides --- */
body.light-mode {
    --bg-dark: #f5f5f5;
    --card-bg: #ffffff;
    --text-main: #212121;
    --accent-purple: #6200ee; /* Deeper purple for readability */
    --accent-teal: #018786;   /* Deeper teal */
    --border: #e0e0e0;
    --text-secondary: #616161;
}

/* Toggle Button Styling */
.theme-toggle {
    background: none;
    border: 2px solid var(--accent-teal);
    color: var(--accent-teal);
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: 0.3s;
    margin-right: 15px; /* Space to the left of your other nav items */
}

.theme-toggle:hover {
    background: var(--accent-teal);
    color: var(--bg-dark);
}

/* --- Base Body Styling --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 2rem 1rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* --- Typography --- */
h1 { color: var(--accent-purple); text-align: center; margin-bottom: 2rem; font-size: clamp(2rem, 5vw, 3rem); }
h2 { color: #ffffff; margin-bottom: 1rem; }
h3 { color: var(--accent-teal); border-bottom: 2px solid var(--border); padding-bottom: 5px; margin-top: 1.5rem; }

/* --- Recipe Grid (Index/Home) --- */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
}

.recipe-card {
    background: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.recipe-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

/* --- Image & Placeholder Logic --- */
.recipe-media { width: 100%; height: 200px; overflow: hidden; background-color: #252525; position: relative;}
.recipe-img { width: 100%; height: 100%; object-fit: cover; }

.no-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prohibition-icon {
    width: 60px; height: 60px;
    border: 6px solid var(--error-red);
    border-radius: 50%;
    position: relative;
}

.prohibition-icon::after {
    content: "";
    position: absolute;
    width: 6px; height: 60px;
    background-color: var(--error-red);
    transform: rotate(45deg);
    left: 27px; top: 0;
}

/* --- Detail Page & Generic Card Containers --- */
.recipe-card-detail, .login-container, .user-list-container {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.recipe-header { text-align: center; margin-bottom: 2.5rem; }
.recipe-header h2 { font-size: clamp(1.8rem, 5vw, 2.5rem); color: #ffffff; margin: 0; }
.description-text { font-style: italic; color: var(--text-secondary); font-size: 1.1rem; margin-bottom: 1.5rem; }

.main-image-display {
    max-width: 100%; 
    max-height: 500px;
    height: auto;
    object-fit: contain; 
    border-radius: 15px;
    border: 1px solid #333;
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 2.5rem;
}

.content-text {
    white-space: pre-wrap;
    font-size: 1.05rem;
    color: #d1d1d1;
    padding-left: 5px;
}

/* --- Forms & Inputs --- */
.form-group { margin-bottom: 1.5rem; width: 100%; }
label { display: block; color: var(--accent-purple); font-weight: bold; margin-bottom: 5px; }

input[type="text"], input[type="password"], input[type="file"], textarea, select {
    width: 100%;
    padding: 12px;
    background: #2c2c2c;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    box-sizing: border-box;
    font-family: inherit;
}

* {
    box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 8px rgba(187, 134, 252, 0.3);
}

/* --- Tables (Admin Console) --- */
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.user-table th, .user-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.user-table th {
    color: var(--accent-purple);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}
.role-admin { background: rgba(187, 134, 252, 0.2); color: var(--accent-purple); border: 1px solid var(--accent-purple); }
.role-user { background: rgba(3, 218, 198, 0.1); color: var(--accent-teal); border: 1px solid var(--accent-teal); }

/* --- Navigation & Buttons --- */
.nav-links, .back-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    margin-top: 1rem;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: transform 0.2s, background 0.3s;
}

.btn:hover { transform: translateY(-2px); }
.btn-teal { background: var(--accent-teal); color: #121212; }
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%; /* Prevents it from pushing out */
}
.btn-delete { background: var(--error-red); color: white; }

/* --- Modals & Flash Messages --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
}

.flash-messages { list-style: none; padding: 0; margin-bottom: 1.5rem; text-align: center; }
.flash-message {
    padding: 10px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-red);
    border: 1px solid var(--error-red);
    font-size: 0.9rem;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .nav-links { flex-direction: column; align-items: stretch; }
    .recipe-item { flex-direction: column; align-items: flex-start; }
}
/* --- Silhouette Button Styling --- */
.silhouette-btn {
    padding: 8px !important;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
}

.user-silhouette {
    width: 14px;
    height: 14px;
    background: var(--accent-teal);
    border-radius: 50%;
    position: relative;
    margin-top: -6px; /* Adjust for the "body" part */
}

.user-silhouette::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 10px;
    background: var(--accent-teal);
    border-radius: 10px 10px 0 0; /* Shoulders */
}
/* --- Password Toggle Styling --- */
.password-toggle {
    position: absolute;
    right: 10px;
    bottom: 8px; /* Aligns with the input box height */
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-icon {
    width: 18px;
    height: 12px;
    border: 2px solid var(--accent-teal);
    border-radius: 50% 50%;
    position: relative;
}

.eye-icon::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: var(--accent-teal);
    border-radius: 50%;
}

/* The "Line Through" effect when hidden */
.eye-closed::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 2px;
    background: var(--error-red);
    transform: translate(-50%, -50%) rotate(45deg);
}

@media print {
    body { background: white !important; color: black !important; padding: 0; }
    .container { width: 100% !important; max-width: 100% !important; }
    .no-print { display: none !important; }
    .recipe-card-detail { 
        box-shadow: none !important; 
        border: none !important; 
        background: white !important;
        padding: 0 !important;
    }
    .main-image-display { max-width: 400px; height: auto; }
    h3, h1 { color: black !important; border-bottom: 2px solid #ccc !important; }
    .content-text { font-size: 11pt; }
}

/* Update this to stop the browser from rendering code-indentation as space */
.content-text {
    white-space: normal; /* Changed from pre-wrap */
    font-size: 1.05rem;
    color: #d1d1d1;
}

/* Ensure the list itself is compressed */
#ingredientList {
    list-style: none;
    padding: 0 !important;
    margin: 0 !important;
}

.ingredient-item {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important; /* Forces the text lines to sit close */
    display: flex;
    align-items: flex-start;
}

.ingredient-item::before {
    content: "•";
    color: var(--accent-teal);
    margin-right: 10px;
    flex-shrink: 0;
}

.search-container input:focus {
    border-color: var(--accent-teal) !important;
    box-shadow: 0 0 15px rgba(3, 218, 198, 0.2);
    outline: none;
}

/* Ensure the grid handles filtered items gracefully */
.recipe-grid {
    transition: all 0.3s ease;
}