:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-primary: #10b981;
    --accent-primary-hover: #059669;
    
    --btn-water: #3b82f6;
    --btn-fertilize: #f59e0b;
    --btn-maintain: #8b5cf6;
    
    --font-main: 'Outfit', sans-serif;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Background Decorations */
.background-decor {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.decor-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #065f46 0%, transparent 70%);
}

.decor-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, #1e3a8a 0%, transparent 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 5%) scale(1.1); }
    100% { transform: translate(-5%, 10%) scale(0.9); }
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-text h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #34d399, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-text p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

/* Buttons */
button {
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
}

.primary-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.primary-btn:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.23);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Glass Panel / Cards */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 1.5rem;
}

.plant-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: var(--transition);
}

.plant-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.plant-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.plant-photo-container {
    width: 100%;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.2);
}

.plant-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.plant-photo-container:hover .plant-photo {
    transform: scale(1.05);
}

.plant-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.plant-location {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.plant-status-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.status-label {
    color: var(--text-muted);
}

.status-value.urgent {
    color: #ef4444;
    font-weight: 600;
}
.status-value.good {
    color: #10b981;
}

.plant-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: auto;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 600;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.action-btn.water svg { color: var(--btn-water); }
.action-btn.fertilize svg { color: var(--btn-fertilize); }
.action-btn.maintain svg { color: var(--btn-maintain); }

.action-btn:active {
    transform: scale(0.95);
}

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

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
    transform: scale(1);
    transition: var(--transition);
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.9);
}

.close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: transparent;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group select option {
    background: var(--bg-darker);
    color: var(--text-main);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.submit-btn {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Role Selection */
.role-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.role-card {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.role-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.role-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.role-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transition: var(--transition);
    border: 1px solid transparent;
}

.role-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
}

.role-btn.admin-role:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.4);
}

.role-btn.user-role:hover {
    border-color: var(--btn-water);
    box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.4);
}

.role-btn svg {
    margin-bottom: 1rem;
}

.role-btn span {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.role-btn small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-nav {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.35rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    background: var(--accent-primary);
    color: var(--bg-main);
    font-weight: 600;
}

.secondary-btn, .header-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

.secondary-btn:hover, .header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.role-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    background: rgba(255,255,255,0.1);
    vertical-align: middle;
}

.role-badge.admin {
    background: var(--accent-primary);
    color: white;
}

.role-badge.user {
    background: var(--btn-water);
    color: white;
}

/* Delete Button */
.delete-btn {
    background: transparent;
    color: #ef4444;
    padding: 0.5rem;
    border-radius: 8px;
    opacity: 0.5;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    opacity: 1;
}

.worker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* History Timeline */
.history-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent-primary);
}
.history-item.water { border-left-color: var(--btn-water); }
.history-item.fertilize { border-left-color: var(--btn-fertilize); }
.history-item.maintain { border-left-color: var(--btn-maintain); }

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.history-title {
    font-weight: 600;
}
.history-photo {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-top: 0.5rem;
    background: rgba(0,0,0,0.2);
}

.history-btn-container {
    margin-top: 1rem;
    text-align: center;
}
.history-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}
.history-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Admin Dashboard */
.admin-dashboard-container {
    margin-bottom: 2rem;
}

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

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.recent-activities-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.recent-activities-container h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem;
}

/* Dashboard Sections New */
.plant-status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}
.plant-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}
.plant-status-row:hover {
    background: rgba(255,255,255,0.06);
}
.plant-info-col {
    display: flex;
    flex-direction: column;
}
.plant-info-col .p-name {
    font-weight: 600;
}
.plant-info-col .p-pic {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.plant-check-col {
    display: flex;
    gap: 0.5rem;
}
.check-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    color: rgba(239, 68, 68, 0.5);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    width: 45px;
    height: 45px;
    font-size: 1rem;
}
.check-box small {
    font-size: 0.65rem;
    margin-bottom: 2px;
}
.check-box.done {
    background: rgba(16, 185, 129, 0.1);
    color: rgba(16, 185, 129, 1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.pic-performance-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.pic-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}
.pic-stats {
    display: flex;
    gap: 1rem;
}
.p-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
}
.p-stat span {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.p-stat strong {
    font-size: 1.1rem;
    color: var(--accent-primary);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}
.activity-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.activity-details {
    display: flex;
    flex-direction: column;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Report View */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
}

.table-container {
    overflow-x: auto;
    padding: 1rem;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.report-table th, .report-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.report-table th {
    font-weight: 600;
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

.report-table tr:hover {
    background: rgba(255,255,255,0.02);
}

.report-photo-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

/* Print Styles */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    
    .app-header, .filter-panel, .report-actions, .no-print, .background-decor {
        display: none !important;
    }

    .report-container {
        display: block !important;
    }
    
    .glass-panel {
        background: none !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .report-table th, .report-table td {
        border-bottom: 1px solid #ccc;
        color: #000;
    }
    
    .report-table th {
        background: #f0f0f0 !important;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    .header-text h1 {
        font-size: 2rem;
    }
    .role-buttons {
        grid-template-columns: 1fr;
    }
    .header-actions {
        align-items: flex-start;
        width: 100%;
    }
    .header-buttons, .header-nav {
        justify-content: flex-start;
        width: 100%;
    }
}
