/* Farm Management System Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Layout with Sidebar */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Modern Sidebar Styles */
.sidebar {
    width: 260px;
    background: #ffffff;
    /* Light modern background */
    color: #5e6278;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    /* Slightly darker shadow for white bg */
    overflow: hidden;
}

.sidebar.compact {
    width: 80px;
}

.sidebar.compact .logo-text,
.sidebar.compact .user-info,
.sidebar.compact .menu-label,
.sidebar.compact .arrow-icon,
.sidebar.compact .menu-item span,
.sidebar.compact .menu-item-content span {
    display: none;
    opacity: 0;
}

.sidebar.compact .menu-item-has-submenu .submenu {
    display: none;
    /* Hide submenus in compact mode for simplicity */
}

.sidebar.compact .sidebar-header {
    justify-content: center;
    padding: 1.5rem 0;
}

.sidebar.compact .logo-icon {
    margin: 0;
    font-size: 1.5rem;
}

.sidebar.compact .sidebar-toggle-btn {
    display: none;
}

.sidebar.compact .menu-item,
.sidebar.compact .menu-item-header {
    justify-content: center;
    padding: 0.8rem 0;
}

.sidebar.compact .menu-item i,
.sidebar.compact .menu-item-header i {
    margin: 0;
    font-size: 1.4rem;
}

/* Sidebar Header */
.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid #f4f4f4;
}

.logo-icon {
    font-size: 1.5rem;
    color: #2c7a2c;
    /* Brand color */
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #3f4254;
    /* Dark Text */
    flex-grow: 1;
    white-space: nowrap;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: #b5b5c3;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    color: #2c7a2c;
    background: #f4f6f8;
}

/* User Profile */
.user-profile {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f4f4f4;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #e8fff3;
    /* Light green bg */
    color: #2c7a2c;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
}

.user-info {
    overflow: hidden;
}

.user-email {
    display: block;
    color: #3f4254;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: #b5b5c3;
    margin-top: 2px;
}

/* Sidebar Menu */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: #e4e6ef;
}

.menu-label {
    padding: 0 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #495057;
    /* Darker gray for labels */
    font-weight: 700;
    /* Increased weight */
}

.menu-label:first-child {
    margin-top: 0;
}

.menu-item,
.menu-item-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #212529;
    /* Almost black for better contrast */
    text-decoration: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
    /* Slightly bolder */
}

.menu-item-header {
    justify-content: space-between;
}

.menu-item-content {
    display: flex;
    align-items: center;
}

.menu-item i,
.menu-item-content i {
    font-size: 1.1rem;
    margin-right: 1rem;
    color: #495057;
    /* Darker icon color */
    transition: color 0.2s;
}

.menu-item:hover,
.menu-item-header:hover {
    color: #1e5c1e;
    /* Darker green on hover */
    background: #f0f2f5;
}

.menu-item:hover i,
.menu-item-header:hover i {
    color: #1e5c1e;
}

.menu-item.active {
    background: #e8fff3;
    color: #1e5c1e;
    /* Darker green for active */
    border-left-color: #2c7a2c;
    font-weight: 600;
}

.menu-item.active i {
    color: #1e5c1e;
}

.arrow-icon {
    font-size: 1rem;
    transition: transform 0.3s;
    margin-right: 0 !important;
}

.menu-item-has-submenu.open .arrow-icon {
    transform: rotate(180deg);
}


.menu-item-has-submenu.open .menu-item-header {
    color: #1e5c1e;
    background: #f8f9fa;
    font-weight: 600;
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #ffffff;
    /* Seamless integration */
}

.menu-item-has-submenu.open .submenu {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
}

.submenu a {
    display: block;
    padding: 0.6rem 1.5rem 0.6rem 3.6rem;
    color: #495057;
    /* Darker text for submenu links */
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    position: relative;

}

.submenu a:hover {
    color: #2c7a2c;
    background: #f4f6f8;
}

.submenu a.active {
    color: #2c7a2c;
    background: #f4f6f8;
    font-weight: 500;
}

.submenu a::before {
    content: '';
    position: absolute;
    left: 2.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #b5b5c3;
    transition: background 0.2s;
}

.submenu a:hover::before,
.submenu a.active::before {
    background: #2c7a2c;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 0;
    border-top: 1px solid #f4f4f4;
}

/* Main Content Adjustment */
.main-content {
    margin-left: 260px;
    flex: 1;
    background: #f4f6f8;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.main-content.expanded {
    margin-left: 80px;
}

.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c0392b;
}

/* Content Area */
.content {
    padding: 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #2c7a2c;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-left: 4px solid #2c7a2c;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #2c7a2c;
}

.stat-label {
    color: #666;
    margin-top: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #2c7a2c;
    box-shadow: 0 0 0 2px rgba(44, 122, 44, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #2c7a2c;
    color: white;
}

.btn-primary:hover {
    background: #236623;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c7a2c;
}

.table tr:hover {
    background: #f8f9fa;
}

/* Messages */
.message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Login Form */
.login-container {
    max-width: 400px;
    margin: 2rem auto;
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c7a2c;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: #2c3e50;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 1rem;
    }

    .content {
        padding: 1rem;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}