/* Main CSS file for Family Calendar Portal */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 300;
}

/* Navigation */
/* Sidebar layout */
.app-layout { display:flex; gap: 0; align-items: stretch; }
.sidebar { width: 260px; background: #ffffff; border-right: 1px solid #eee; }
.sidebar-inner { position: sticky; top: 0; height: calc(100vh - 0px); display:flex; flex-direction: column; padding: 16px 12px; }
.profile-link { display:flex; align-items:center; gap:10px; padding:8px 8px; border-radius:8px; text-decoration:none; color:#333; margin-bottom: 12px; }
.profile-link:hover { background:#f5f6ff; }
.profile-link { width: 100%; text-align: left; background: transparent; border: none; cursor: pointer; }
.profile-caret { margin-left: auto; color:#666; }
.profile-dropdown { position: relative; }
.profile-menu { position: relative; margin-top: 8px; background:#fff; border:1px solid #eee; border-radius:10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding:8px; display:none; }
.profile-menu a { display:block; padding:10px; border-radius:8px; color:#333; text-decoration:none; }
.profile-menu a:hover { background:#f5f6ff; }
.profile-menu a.danger { background:#ffeceb; color:#c0392b; }
.profile-menu a.danger:hover { background:#ffdedd; }
.profile-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.profile-name { font-weight: 600; line-height: 1.2; }
.sidebar-menu { list-style: none; display:flex; flex-direction: column; gap:4px; padding:0; margin: 8px 0 0 0; }
.sidebar-menu a { display:block; padding:10px 10px; border-radius:8px; color:#333; text-decoration:none; font-weight:500; }
.sidebar-menu a:hover { background:#f5f6ff; color:#4b57d5; }
.sidebar-bottom { margin-top: 24px; padding-top: 8px; }
.logout-link { display:block; padding:10px 10px; border-radius:8px; background:#ffeceb; color:#c0392b; text-decoration:none; font-weight:600; text-align:center; }
.logout-link:hover { background:#ffdedd; }

.content { flex: 1; min-width: 0; }

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card h2 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

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

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

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

/* Calendar specific styles */
.calendar-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 2rem;
}

.fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
}

.fc-event:hover {
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid #eee; }
    .sidebar-inner { position: relative; height: auto; }
    
    .card {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
/* -------- Budget page + utilities -------- */
/* Layout helpers */
.container-narrow { max-width: 1100px; }
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 1rem; gap: .5rem; flex-wrap: wrap; }
.page-header-actions { display:flex; gap:.5rem; align-items:center; }
.toolbar { display:flex; gap:.5rem; flex-wrap: wrap; align-items: center; }

/* Tabs */
.tabs { display:flex; gap:.5rem; list-style:none; padding-left:0; border-bottom:1px solid #ddd; }
.tabs li { margin: 0; }
.tabs a { display:inline-block; padding:.5rem .75rem; color:#333; text-decoration:none; border-radius:6px 6px 0 0; }
.tabs a.active { background:#f5f6ff; border:1px solid #ddd; border-bottom-color:#fff; color:#4b57d5; }

/* Width utilities */
.w-120 { width:120px; }
.w-140 { width:140px; }
.w-160 { width:160px; }
.w-180 { width:180px; }
.w-200 { width:200px; }
.minw-220 { min-width:220px; }
.minw-240 { min-width:240px; }
.flex-1 { flex:1 1 200px; }
.overflow-auto { overflow:auto; }
.small { font-size:.9rem; }

/* Buttons */
.btn-sm { padding: .4rem .6rem; font-size: .9rem; }
.btn-danger { background:#dc3545; color:#fff; }
.btn-danger:hover { background:#c82333; }
.btn-icon { width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center; padding:0; border-radius:6px; }

/* Budget lists */
.budget-cat { display:flex; align-items:center; justify-content:space-between; padding:.4rem 0; border-bottom:1px solid #eee; gap:.5rem; }
.budget-tx { display:grid; grid-template-columns: 1fr 100px 90px 130px auto; gap:.5rem; align-items:center; padding:.4rem 0; border-bottom:1px solid #eee; }
.actions { display:flex; gap:.25rem; }

/* -------- Recipes: align form controls -------- */
/* Normalize control heights for alignment within ingredient builder */
.recipe-form .form-control { height: 38px; padding: 0 .75rem; }
.recipe-form textarea.form-control { height: auto; padding: .75rem; }

/* Ingredient builder row: keep inputs aligned and wrapping nicely */
.ingredient-row { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.ingredient-row .ing-qty { max-width: 120px; }
.ingredient-row .ing-unit { max-width: 200px; }
.ingredient-row .ing-note { max-width: 240px; }

/* Make primary button match input height */
.ingredient-row .btn { height: 38px; line-height: 1; }

/* Link-styled small button for "add new product" inline under search */
#addNewProduct.btn.btn-link.btn-sm {
    padding: 0;
    height: auto;
    line-height: 1.2;
}
