/* ============================================
   MibiGrow - Sidebar Layout Styles
   Color scheme: Orange accent, Navy sidebar
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #e67e22;
    --primary-dark: #d35400;
    --primary-light: #f39c12;
    --sidebar-bg: #1a252f;
    --sidebar-hover: #2c3e50;
    --sidebar-active: #e67e22;
    --text-light: #ecf0f1;
    --text-muted: #95a5a6;
    --body-bg: #f5f6fa;
    --card-bg: #ffffff;
    --border-color: #dce1e6;

    /* Organism group colors */
    --yeast-color: #FFA500;
    --fungi-color: #8B4513;
    --cyanobacteria-color: #00CED1;
    --gram-positive-color: #9370DB;
    --gram-negative-color: #4169E1;
    --trypanosomatid-color: #DC143C;
    --lichen-color: #228B22;

    /* Sharp corners — override Bootstrap radius variables */
    --bs-border-radius: 0;
    --bs-border-radius-sm: 0;
    --bs-border-radius-lg: 0;
    --bs-border-radius-xl: 0;
    --bs-border-radius-xxl: 0;
    --bs-border-radius-pill: 0;
    --bs-card-border-radius: 0;
    --bs-card-inner-border-radius: 0;
    --bs-btn-border-radius: 0;
    --bs-modal-border-radius: 0;
    --bs-modal-inner-border-radius: 0;
}

/* Reset and Base */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--body-bg);
    display: flex;
    overflow-x: hidden;
}

/* ============================================
   Sidebar Styles
   ============================================ */

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--text-light);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.sidebar-header small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 10px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-hover);
    border-left-color: var(--sidebar-active);
    color: var(--primary-color);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
}

.sidebar-nav .nav-link .badge {
    margin-left: auto;
    font-size: 0.65rem;
}

/* Login section in sidebar */
.sidebar-login {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-login .btn-login {
    width: 100%;
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 0;
    font-weight: 600;
    transition: all 0.2s;
}

.sidebar-login .btn-login:hover {
    background: var(--primary-dark);
}

.sidebar-login .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-login .user-info span {
    flex: 1;
    font-size: 0.85rem;
}

.sidebar-login .btn-logout {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 0;
    font-size: 0.75rem;
}

/* Mode selector in sidebar */
.header-mode-selector .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

#loginBtn:hover {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    background: white;
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: #2c3e50;
}

.hdr-home-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}

.hdr-home {
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
    transition: background 120ms;
    padding: 0;
    flex-shrink: 0;
    border-radius: 4px;
}

.hdr-home:hover {
    background: rgba(0,0,0,0.08);
}

.breadcrumb {
    margin: 0;
    background: transparent;
    padding: 0;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.content-area {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
}

/* ============================================
   Tabulator Table Customization
   ============================================ */

.tabulator {
    border: 1px solid var(--border-color);
    border-radius: 0;
    overflow: hidden;
}

.tabulator-header {
    background: #f8f9fa;
    border-bottom: 2px solid var(--primary-color);
}

.tabulator-header .tabulator-col {
    background: transparent;
    border-right: 1px solid var(--border-color);
}

.tabulator-header .tabulator-col-title {
    font-weight: 600;
    color: #2c3e50;
}

.tabulator-row {
    border-bottom: 1px solid var(--border-color);
}

.tabulator-row:hover {
    background: #fff9f5 !important;
}

.tabulator-row.tabulator-row-even {
    background: #fafbfc;
}

.tabulator-row.tabulator-row-odd {
    background: white;
}

.tabulator-cell {
    padding: 10px 12px;
}

.tabulator-cell a {
    color: var(--primary-color);
    text-decoration: none;
}

.tabulator-cell a:hover {
    text-decoration: underline;
}

/* Tabulator pagination */
.tabulator-paginator {
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
}

.tabulator-paginator button.active {
    background: var(--primary-color) !important;
    color: white !important;
}

/* ============================================
   Cards and Stats
   ============================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 0;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-left: 4px solid var(--primary-color);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .stat-label {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Regular cards */
.card {
    border: none;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 15px 20px;
}

.card-body {
    padding: 20px;
}

/* ============================================
   Recipe View Styles
   ============================================ */

.recipe-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.recipe-section {
    background: white;
    border-radius: 0;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.recipe-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.solution-block {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 0;
}

.solution-block h5 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1rem;
}

.recipe-table {
    width: 100%;
    margin-bottom: 0;
}

.recipe-table th {
    background: #ecf0f1;
    font-size: 0.8rem;
    padding: 8px 10px;
}

.recipe-table td {
    padding: 8px 10px;
    font-size: 0.85rem;
}

.recipe-table tr:hover {
    background: #fff9f5;
}

.step-row {
    background: #e8f5e9 !important;
}

.step-row td {
    font-size: 0.8rem;
    color: #2e7d32;
}

/* ============================================
   Organism Group Colors
   ============================================ */

.group-yeast { border-left-color: var(--yeast-color); }
.group-fungi { border-left-color: var(--fungi-color); }
.group-cyanobacteria { border-left-color: var(--cyanobacteria-color); }
.group-gram-positive { border-left-color: var(--gram-positive-color); }
.group-gram-negative { border-left-color: var(--gram-negative-color); }
.group-trypanosomatid { border-left-color: var(--trypanosomatid-color); }
.group-lichen { border-left-color: var(--lichen-color); }

/* ============================================
   MibiNet Premium Styles
   ============================================ */

.mibinet-highlight {
    border: 2px solid var(--primary-light) !important;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.3);
    background-color: #fff9f5 !important;
}

/* Tabulator row highlighting for MibiNet data */
.tabulator-row.mibinet-highlight {
    background-color: #fff9f5 !important;
    box-shadow: inset 4px 0 0 var(--primary-color);
    border: none !important;
}

.tabulator-row.mibinet-highlight:hover {
    background-color: #fff3e6 !important;
}

.mibinet-badge {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 0;
    font-weight: bold;
}

.mibinet-stat {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-left-color: var(--primary-light);
}

.mibinet-stat .stat-number {
    color: var(--primary-dark);
}

.pro-badge {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 0;
    font-weight: bold;
}

/* ============================================
   Charts
   ============================================ */

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.chart-container canvas {
    max-width: 100%;
}

/* ============================================
   Loading Overlay
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   Utility Classes
   ============================================ */

.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .recipe-container {
        grid-template-columns: 1fr;
    }

    .sidebar-toggle {
        display: block !important;
    }
}

.sidebar-toggle {
    display: none;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 0;
    cursor: pointer;
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* ============================================
   Modal Enhancements
   ============================================ */

.modal-content {
    border: none;
    border-radius: 0;
}

.modal-header {
    background: var(--sidebar-bg);
    color: white;
    border-radius: 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    border-radius: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* ============================================
   Ingredient Analysis Badges
   ============================================ */

.analysis-badge {
    text-align: center;
    padding: 10px;
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.analysis-badge:hover {
    transform: translateY(-2px);
}

.analysis-badge span {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.8;
}

.analysis-badge strong {
    display: block;
    font-size: 0.9rem;
}

.analysis-badge.neutral { background: #e9ecef; color: #495057; }
.analysis-badge.balanced { background: #d1ecf1; color: #0c5460; }
.analysis-badge.acidic { background: #fff3cd; color: #856404; }
.analysis-badge.alkaline { background: #cce5ff; color: #004085; }
.analysis-badge.low { background: #d4edda; color: #155724; }
.analysis-badge.moderate { background: #fff3cd; color: #856404; }
.analysis-badge.high { background: #f8d7da; color: #721c24; }

/* ============================================
   Footer
   ============================================ */

.main-footer {
    background: white;
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
