:root {
  --bg-color: #0F0A1E; /* Deep dark purple/black */
  --bg-surface: rgba(25, 15, 45, 0.7);
  --bg-surface-hover: rgba(35, 20, 60, 0.8);
  --border-color: rgba(139, 92, 246, 0.2);
  --border-highlight: rgba(139, 92, 246, 0.5);
  
  --primary: #8B5CF6;       /* Violet Purple */
  --primary-hover: #7C3AED;
  --secondary: #A78BFA;
  --accent: #F97316;        /* Orange accent for attention */
  
  --success: #10B981;       /* Green for healthy */
  --warning: #F59E0B;
  --danger: #EF4444;
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 15px rgba(139, 92, 246, 0.2);
  
  --transition: all 0.2s ease;
  --font-sans: 'Inter', system-ui, sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.03) 0%, transparent 40%);
}

/* Glassmorphism */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* Utilities */
.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pt-4 { padding-top: 1rem; }
.border-b { border-bottom: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-align { display: flex; align-items: center; gap: 0.5rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.relative { position: relative; }
.scrollable { overflow-y: auto; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex-grow: 1; }
.max-h-70vh { max-height: 70vh; }

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-primary { background: rgba(139, 92, 246, 0.2); color: var(--secondary); border: 1px solid var(--border-color); }

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

.sidebar {
  width: 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo h1 { font-size: 1.25rem; font-weight: 700; color: var(--text-main); }

.sidebar-nav {
  padding: 1.5rem 1rem;
  flex: 1;
  overflow-y: auto;
}
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    width: 100%; padding: 0.75rem 1rem;
    background: transparent; border: none;
    color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
    border-radius: var(--radius-sm); transition: var(--transition);
    text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.nav-item.active { background: rgba(139, 92, 246, 0.15); color: var(--primary); font-weight: 600; }
.nav-section { margin-top: 1.5rem; }
.nav-heading { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.5rem; padding-left: 1rem; }
.nav-list { list-style: none; }
.sub-item { font-size: 0.9rem; padding: 0.5rem 1rem 0.5rem 2.8rem; }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}
.header-titles h2 { font-size: 1.5rem; font-weight: 700; }

.view-content {
    padding: 2rem;
    flex: 1;
}

.section-title { font-size: 1.25rem; font-weight: 600; }
.divider { height: 1px; background: var(--border-color); margin: 2rem 0; }

/* Plant Grid */
.plant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.plant-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}
.plant-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-highlight);
}
.plant-img {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255,255,255,0.05);
    position: relative;
}
.plant-status-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}
.status-good { background: rgba(16, 185, 129, 0.8); color: white; }
.status-warn { background: rgba(245, 158, 11, 0.8); color: black; }
.status-bad { background: rgba(239, 68, 68, 0.8); color: white; }

.plant-info {
    padding: 1rem;
    flex: 1;
    display: flex; flex-direction: column;
}
.plant-name { font-weight: 600; font-size: 1.1rem; }
.plant-species { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.plant-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }

/* Empty State */
.empty-state {
    padding: 3rem 1.5rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    grid-column: 1 / -1;
}

/* Forms */
.form-layout { display: flex; flex-direction: column; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500;}
.form-control {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
}
.form-control:focus { outline: none; border-color: var(--primary); }

.photo-upl-area { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.photo-preview {
    width: 80px; height: 80px; border-radius: var(--radius-sm);
    background-size: cover; background-position: center; border: 1px solid var(--border-color);
    position: relative; overflow: hidden;
}
.photo-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; text-align: center; opacity: 0; transition: var(--transition);
}
.photo-preview:hover .photo-overlay { opacity: 1; }

/* Modals */
.modal { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); 
    display: flex; align-items: center; justify-content: center; 
    z-index: 100; padding: 1rem; backdrop-filter: blur(8px);
}
.modal-content { width: 100%; max-width: 450px; }
.modal-lg { max-width: 600px; }

/* Details Layout */
.details-layout { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; }
.det-image { height: 250px; border-radius: var(--radius-sm); background-size: cover; background-position: center; border: 1px solid var(--border-color); }
.info-card { padding: 1rem; }
.status-indicator { font-size: 1.1rem; font-weight: 600; }
.care-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.care-item { display: flex; flex-direction: column; }
.care-item .lbl { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.2rem;}
.care-item .val { font-weight: 500; font-size: 0.9rem;}
.notes-p { white-space: pre-wrap; line-height: 1.5; }

/* Timeline */
.timeline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 1rem; }
.tl-item { display: flex; flex-direction: column; gap: 0.25rem; }
.tl-img { height: 100px; border-radius: var(--radius-sm); background-size: cover; background-position: center; border: 1px solid var(--border-color); }
.tl-date { font-size: 0.75rem; color: var(--text-muted); text-align: center; }

/* Buttons */
button { font-family: var(--font-sans); cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.icon-btn { background: none; border: none; color: var(--text-muted); padding: 0.5rem; border-radius: 50%; }
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-main); }
.btn-primary { background: var(--primary); color: white; border: none; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); font-weight: 600;}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border-highlight); color: var(--text-main); padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); font-weight: 500;}
.btn-outline:hover { background: rgba(139, 92, 246, 0.1); border-color: var(--primary); color: var(--text-main); }
.btn-text { background: none; border: none; color: var(--text-muted); padding: 0.5rem 1rem; font-size: 0.9rem;}
.btn-text:hover { color: var(--text-main); }

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); flex-shrink: 0;}
    .sidebar-nav { max-height: 150px; }
    .main-content { overflow-y: auto; }
    .form-grid { grid-template-columns: 1fr; }
    .details-layout { grid-template-columns: 1fr; }
    .det-image { height: 200px; }
}

/* Print Styles for PDF Export */
@media print {
    body { background: white !important; color: black !important; }
    * { background: transparent !important; color: black !important; border-color: #ddd !important; box-shadow: none !important;}
    .no-print { display: none !important; }
    .glass-panel { border: 1px solid #ccc; backdrop-filter: none; background: white;}
    .view-content { padding: 0; }
    .plant-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 10px; }
    .plant-card { break-inside: avoid; border: 1px solid #ccc; }
    .plant-img { background-color: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact;}
    .app-container { height: auto; display: block; }
}
