:root {
    --bg-color: #121212;
    --sidebar-bg: #1e1e1e;
    --card-bg: rgba(30, 30, 30, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent: #ff9800; /* Warm orange */
    --accent-hover: #e68900;
    --success: #4caf50;
    --warning: #ffb300;
    --danger: #f44336;
    --font-family: 'Outfit', sans-serif;
    --transition: all 0.3s ease;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Base UI Elements */
a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

button ion-icon {
    font-size: 1.2rem;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background-color: var(--accent-hover); transform: translateY(-2px); }

.btn-secondary {
    background-color: #333;
    color: var(--text-primary);
}
.btn-secondary:hover { background-color: #444; }

.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: #111; }
.btn-danger { background: var(--danger); color: white; }

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

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

.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--card-border);
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 3rem;
}

.sidebar .logo ion-icon {
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 400;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-links li.active a, .nav-links li a:hover {
    background-color: rgba(255, 152, 0, 0.1);
    color: var(--accent);
}

/* Main Content Wrapper */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    position: relative;
    background: radial-gradient(circle at top left, #1a1a1a, var(--bg-color));
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

header p {
    color: var(--text-secondary);
    font-weight: 300;
}

/* Sections */
section {
    margin-bottom: 3rem;
}

section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Notifications */
.notifications-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-card {
    background: rgba(40, 40, 40, 0.8);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--accent);
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: slideIn 0.5s ease;
}

.alert-card.warning { border-color: var(--warning); }
.alert-card.success { border-color: var(--success); }
.alert-card.danger { border-color: var(--danger); }

.alert-card ion-icon {
    font-size: 1.8rem;
}

.alert-card.warning ion-icon { color: var(--warning); }
.alert-card.success ion-icon { color: var(--success); }
.alert-card.danger ion-icon { color: var(--danger); }
.alert-card.accent ion-icon { color: var(--accent); }

.alert-content strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.alert-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.empty-state-text {
    color: var(--text-secondary);
    font-style: italic;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px dashed var(--card-border);
    text-align: center;
}

/* Records Grid Container */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Hen Card Styling */
.record-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.record-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    border-color: rgba(255, 152, 0, 0.3);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.record-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hen-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #333;
    border: 2px solid var(--accent);
}

.hen-info h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.hen-info span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

.hen-status {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 5px 10px;
    background: rgba(255, 152, 0, 0.2);
    color: var(--accent);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.record-stats {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.stat-row:last-child { margin-bottom: 0; }
.stat-label { color: var(--text-secondary); }
.stat-value { font-weight: 600; }

.progress-container {
    width: 100%;
    height: 6px;
    background: var(--card-border);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.counter-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 2px 8px;
}
.btn-counter {
    background: transparent;
    color: var(--text-primary);
    padding: 2px 6px;
    font-size: 1.1rem;
    border-radius: 4px;
    cursor: pointer;
    min-width: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.btn-counter:hover {
    background: rgba(255, 255, 255, 0.1);
}
.success-color {
    color: var(--success);
    font-weight: 700;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--warning), var(--accent));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--sidebar-bg);
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: var(--transition);
}
.modal-small {
    max-width: 400px;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 1.3rem; }

.close-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 5px;
    font-size: 1.4rem;
}
.close-btn:hover { background: rgba(255,255,255,0.1); color: white; }

.modal-body {
    padding: 20px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
    color: white;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.2);
}

.image-upload-wrapper {
    position: relative;
    border: 2px dashed var(--card-border);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-wrapper:hover {
    border-color: var(--accent);
    background: rgba(255, 152, 0, 0.05);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    gap: 10px;
}
.upload-placeholder ion-icon { font-size: 2.5rem; color: var(--accent); }

.image-upload-wrapper img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

.form-actions-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form-actions-column button {
    justify-content: center;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* View System */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* History Filters */
.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 152, 0, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 152, 0, 0.2);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.filter-btn:hover:not(.active) {
    border-color: var(--accent);
    color: var(--accent);
}

/* Crops/Seeding Section */
.crops-section {
    margin-bottom: 3rem;
}

.crops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.crop-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition);
    overflow: hidden;
}

.crop-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    border-color: rgba(76, 175, 80, 0.3);
}

.crop-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.crop-icon {
    width: 50px;
    height: 50px;
    background: rgba(76, 175, 80, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.crop-header h3 {
    font-size: 1.2rem;
    margin: 0;
}

.crop-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crop-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
}

.crop-detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 120px;
}

.crop-detail-value {
    color: var(--text-primary);
    text-align: right;
    flex: 1;
}

.crop-timeline {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--card-border);
}

.timeline-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.timeline-content {
    flex: 1;
}

.timeline-content strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.timeline-content span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Tips Container */
.tips-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tip-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    border-left: 4px solid var(--success);
}

.tip-card h4 {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.tip-card h4 ion-icon {
    font-size: 1.3rem;
    color: var(--success);
}

.tip-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.mt-5 { margin-top: 2.5rem; }

/* History Record Card */
.history-record-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: var(--transition);
}

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

.history-status {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.history-status.hatched {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.history-status.failed {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger);
}

.history-record-card {
    position: relative;
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; padding: 1rem; border-right: none; border-bottom: 1px solid var(--card-border); flex-direction: row; justify-content: space-between; align-items: center; }
    .sidebar .logo { margin-bottom: 0; }
    .nav-links { flex-direction: row; }
    .nav-links li a span { display: none; }
    .main-content { padding: 1.5rem; }
    .records-grid, .crops-grid, .tips-container { grid-template-columns: 1fr; }
}
