/* BetterMix - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 240px;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    position: relative;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 16px;
    color: #111827;
    white-space: nowrap;
}

.sidebar.collapsed .logo-text {
    display: none;
}

.collapse-btn {
    position: absolute;
    top: 20px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #6b7280;
    transition: all 0.2s;
}

.collapse-btn:hover {
    background-color: #f3f4f6;
}

.add-recipe-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.add-recipe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar.collapsed .add-recipe-btn span:last-child {
    display: none;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: #f3f4f6;
}

.nav-item.active {
    background-color: #dbeafe;
    color: #2563eb;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item span:not(.nav-icon) {
    display: none;
}

.sidebar-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
    margin-top: auto;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.settings-item:hover {
    background-color: #f3f4f6;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #d1d5db;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
}

.sidebar.collapsed .user-info {
    display: none;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.user-email {
    font-size: 12px;
    color: #6b7280;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px 120px 40px;
}

.page-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-left {
    flex: 1;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 16px;
    color: #6b7280;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #f9fafb;
}

.btn-dark {
    background-color: #111827;
    color: white;
}

.btn-dark:hover {
    background-color: #1f2937;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.stat-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.stat-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    transition: all 0.2s;
}

.stat-link:hover {
    color: #2563eb;
}

/* ==================== TABLE ==================== */
.table-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.search-filter-row {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    min-width: 180px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 16px 24px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.data-table tbody tr {
    transition: all 0.2s;
    cursor: pointer;
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

/* ==================== BADGES & STATUS ==================== */
.status-badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-awaiting {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-finalized {
    background-color: #d1fae5;
    color: #065f46;
}

.status-development {
    background-color: #fed7aa;
    color: #92400e;
}

.status-draft {
    background-color: #f3f4f6;
    color: #374151;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background-color: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    margin-right: 4px;
}

.brand-logo {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #d1d5db;
}

.composition-info {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
}

.action-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.action-icon:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* ==================== EDIT FORM ==================== */
.edit-container {
    max-width: 1400px;
    margin: 0 auto;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
    text-decoration: none;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.back-link:hover {
    color: #374151;
}

.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 32px;
    overflow-x: auto;
}

.tab {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:hover {
    color: #374151;
}

.tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

.form-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
}

@media (max-width: 1200px) {
    .form-layout {
        grid-template-columns: 1fr;
    }
}

.form-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.section-subtitle {
    font-size: 13px;
    color: #6b7280;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:disabled {
    background-color: #f9fafb;
    cursor: not-allowed;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s;
}

.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.help-text {
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
    display: block;
}

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-label {
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 13px;
    color: #6b7280;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

/* ==================== STICKY FOOTER ==================== */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    transition: left 0.3s ease;
}

.sidebar.collapsed + .main-content .sticky-footer {
    left: 80px;
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-text {
    font-size: 14px;
    color: #6b7280;
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #f3f4f6;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== LOADING ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: #6b7280;
}

/* ==================== UTILITY CLASSES ==================== */
.hidden {
    display: none !important;
}

/* ==================== NEW FEATURES STYLES ==================== */

/* Recipe Type Badge */
.recipe-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background-color: #fef3c7;
    color: #92400e;
}

/* Leftover Section */
.leftover-reference {
    background-color: #fef3c7;
    border: 1px solid #fde047;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.leftover-title {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 6px;
}

/* Nutrient Groups */
.nutrient-groups {
    margin-top: 24px;
}

.group-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.group-section:last-child {
    border-bottom: none;
}

.group-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.group-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Packaging */
.packaging-specs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.pallet-info {
    background-color: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.pallet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}

/* Process Materials */
.material-type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.toggle-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #2563eb;
}

/* Claims Hierarchy */
.claims-hierarchy {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.claim-level {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.claim-level-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.level-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.level-1 { background-color: #dc2626; }
.level-2 { background-color: #ea580c; }
.level-3 { background-color: #ca8a04; }
.level-4 { background-color: #65a30d; }
.level-5 { background-color: #059669; }

.claim-level-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

/* Sync Status */
.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
}

.sync-synced {
    background-color: #d1fae5;
    color: #065f46;
}

.sync-pending {
    background-color: #fef3c7;
    color: #92400e;
}

/* Client Logo Upload */
.client-logo-input {
    width: 80px;
    height: 80px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    text-align: center;
    transition: all 0.2s;
}

.client-logo-input:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Inventory Item Icons */
.inventory-item-icon {
    width: 32px;
    height: 32px;
    background-color: #f3f4f6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Claim Tags in Inventory */
.claim-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.claim-tag {
    padding: 2px 8px;
    background-color: #d1fae5;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #065f46;
}

/* Micronutrient Info */
.nutrient-count {
    font-size: 12px;
    color: #6b7280;
}

/* Notifications */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

.notification.success {
    background-color: #d1fae5;
    color: #065f46;
}

.notification.error {
    background-color: #fee2e2;
    color: #991b1b;
}

.notification.info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Responsive */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .group-grid {
        grid-template-columns: 1fr;
    }
    
    .packaging-specs {
        grid-template-columns: 1fr;
    }
    
    .pallet-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-list {
        grid-template-columns: 1fr;
    }
    
    .sticky-footer {
        left: 0;
        flex-direction: column;
        gap: 12px;
    }
}

/* Sidebar Tab Content */
.sidebar-tab-content {
    animation: fadeIn 0.2s ease;
}

.sidebar-tab-content.hidden {
    display: none;
}