:root {
    --primary: #059669;
    --primary-light: #08da97;
    --primary-dark: #047857;
    --secondary: #81c784;
    --accent: #ff8f00;
    --success: #43a047;
    --warning: #ffb300;
    --error: #e53935;
    --text-primary: #212121;
    --text-secondary: #757575;
    --background: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --sidebar-width: 250px;
    --header-height: 64px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(to bottom, var(--primary-dark), var(--primary));
    color: white;
    position: fixed;
    height: 100vh;
    transition: all var(--transition-speed);
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-container {
    background-color: white;
    width: 140px;
    height: 140px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 15px;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-icon {
    font-size: 24px;
    color: var(--primary);
}

.sidebar-header h2 {
    display: none;
}

.sidebar-menu {
    padding: 1px 0;
}

.menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all var(--transition-speed);
    position: relative;
    overflow: hidden;
}

.menu-item:before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    z-index: -1;
}

.menu-item:hover:before {
    left: 0;
}

.menu-item:hover, .menu-item.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.menu-item.active {
    border-left: 4px solid white;
}

.menu-item i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.menu-item span {
    font-weight: 500;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    height: var(--header-height);
    background-color: var(--card-bg);
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding: 8px;
    border-radius: 8px;
    transition: background-color var(--transition-speed);
}

.user-menu:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-info {
    margin-right: 12px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.2;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.content {
    padding: 24px;
    flex: 1;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

.page h2 {
    margin-bottom: 16px;
    font-size: 20px;
    color: var(--primary-dark);
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    padding: 24px;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: rgba(46, 125, 50, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform var(--transition-speed);
}

.card:hover .card-icon {
    transform: scale(1.1);
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.tabs-container {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin-bottom: 32px;
}

.tabs-header {
    display: flex;
    background-color: #f9f9f9;
    border-bottom: 1px solid var(--border-color);
}

.tab-item {
    padding: 16px 24px;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-speed);
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
}

.tab-item:hover {
    color: var(--primary);
    background-color: rgba(0, 0, 0, 0.02);
}

.tab-item.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
    background-color: white;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

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

.btn-secondary:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px);
}

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

.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 16px;
    border-radius: 8px;
    background-color: white;
    border: 1px solid var(--border-color);
}

.table-container table {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

th:first-child, td:first-child {
    width: 80px;
}

th:nth-child(2), td:nth-child(2) {
    min-width: 150px;
}

th:nth-child(3), td:nth-child(3) {
    min-width: 120px;
}

th:nth-child(4), td:nth-child(4) {
    min-width: 100px;
}

th:last-child, td:last-child {
    width: 100px;
    white-space: nowrap;
    text-align: center;
}

th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 1;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.action-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    margin-right: 8px;
    font-size: 16px;
    transition: transform var(--transition-speed);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.action-btn:hover {
    background-color: rgba(46, 125, 50, 0.1);
    transform: scale(1.1);
}

.action-btn.delete {
    color: var(--error);
}

.action-btn.delete:hover {
    background-color: rgba(229, 57, 53, 0.1);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalAppear 0.3s ease forwards;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 2;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: var(--error);
    background-color: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(85vh - 130px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background-color: white;
    z-index: 2;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        overflow: visible;
        overflow-x: hidden;
    }
    
    .sidebar-header {
        padding: 12px 8px;
    }
    
    .sidebar-header h2 {
        display: none;
    }
    
    .logo-container {
        width: 40px;
        height: 40px;
        padding: 6px;
        border-radius: 8px;
    }
    
    .logo-img {
        max-width: 100%;
        max-height: 100%;
    }
    
    .menu-item span {
        display: none;
    }
    
    .menu-item i {
        margin-right: 0;
        font-size: 20px;
    }
    
    .menu-item {
        justify-content: center;
        padding: 12px;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .header {
        padding: 0 16px;
    }
    
    .header-title {
        font-size: 16px;
    }
    
    .content {
        padding: 16px;
    }
    
    .page h2 {
        font-size: 18px;
    }
    
    .user-info {
        display: none;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 16px;
    }
    
    .card-title {
        font-size: 15px;
    }
    
    .card-value {
        font-size: 26px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .preview-container {
        flex-direction: column;
    }
    
    .preview-map, .polygon-config {
        width: 100%;
    }
    
    .bulk-actions {
        flex-wrap: wrap;
    }
    
    .table-container {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
    
    .table-container table {
        min-width: 0;
        table-layout: fixed;
    }
    
    th, td {
        white-space: normal;
        word-break: break-word;
        hyphens: auto;
        padding: 8px 10px;
        font-size: 13px;
        line-height: 1.4;
    }
    
    th:first-child, td:first-child,
    th:nth-child(2), td:nth-child(2),
    th:nth-child(3), td:nth-child(3),
    th:nth-child(4), td:nth-child(4),
    th:last-child, td:last-child {
        width: auto;
        min-width: 0;
    }
}

@media (max-width: 576px) {
    .content {
        padding: 16px;
    }
    
    .header-title {
        font-size: 15px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    .card-value {
        font-size: 22px;
    }
    
    .page h2 {
        font-size: 17px;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-item {
        width: 100%;
        text-align: center;
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 8px;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .table-container {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
    
    .table-container table {
        table-layout: fixed;
    }
    
    th, td {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
}

/* Additional styles for the profile modal and user menu buttons */
#add-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Article form enhancements */
.article-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.article-form .form-row {
    display: grid;
    gap: 12px;
}

.article-form .form-row.two-cols {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.article-form .form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: block;
}

.article-form .form-group input,
.article-form .form-group select,
.article-form .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #f9f9f9;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-size: 14px;
}

.article-form .form-group textarea {
    min-height: 140px;
    resize: vertical;
}

.article-form .form-group input:focus,
.article-form .form-group select:focus,
.article-form .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.article-form .field-hint {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Quill editor container */
#article-content-editor {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    min-height: 280px;
}

#article-content-editor .ql-toolbar {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

#article-content-editor .ql-container {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

#article-content-editor .ql-editor {
    min-height: 220px;
    font-size: 14px;
}

/* Card content styling */
.card-content {
    padding: 30px;
    text-align: center;
}

.card-content p {
    margin-bottom: 20px;
}
