/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background-color: var(--secondary-color);
    margin: 50px auto;
    padding: 20px;
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    color: var(--accent-color);
    margin: 0;
}

.close-button {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--accent-color);
}

/* Area Details Modal */
.area-details {
    margin-top: 20px;
}

.area-details h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

.area-details .location {
    color: #888;
    margin-bottom: 15px;
}

.area-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
}

.area-details .mobs {
    margin-bottom: 20px;
}

.area-details .resources {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.resources-section {
    background-color: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 4px;
}

.resources-section h4 {
    color: var(--accent-color);
    margin-bottom: 10px;
}

.resources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.resources-list li {
    margin-bottom: 5px;
    color: #ddd;
}

/* Monthly Stats in Modal */
.monthly-stats-section {
    background-color: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.monthly-stats-section h4 {
    color: var(--accent-color);
    margin-bottom: 10px;
}

.monthly-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.monthly-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.monthly-stat-item .label {
    color: #888;
}

.monthly-stat-item .value {
    color: var(--accent-color);
    font-weight: bold;
}

/* Monthly History */
.monthly-history {
    margin-top: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 15px;
}

.monthly-history h4 {
    color: #4CAF50;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.monthly-history-grid {
    display: grid;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.monthly-history-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    align-items: center;
}

.monthly-history-item .month {
    color: #fff;
}

.monthly-history-item .globals,
.monthly-history-item .contribution {
    color: #4CAF50;
    text-align: right;
}

.monthly-history-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 10px;
    font-weight: bold;
    color: #888;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.monthly-history-header span:nth-child(2),
.monthly-history-header span:nth-child(3) {
    text-align: right;
}

/* History Modal Styles */
.history-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.history-tab {
    padding: 10px 20px;
    background-color: #2d2d2d;
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.history-tab:hover {
    background-color: #4CAF50;
}

.history-tab.active {
    background-color: #4CAF50;
}

.history-tab-content {
    display: none;
}

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

.history-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    background-color: #2d2d2d;
    padding: 10px;
    font-weight: bold;
    border-radius: 5px 5px 0 0;
}

.history-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 400px;
    overflow-y: auto;
    background-color: #1a1a1a;
    border-radius: 0 0 5px 5px;
}

.history-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    padding: 10px;
    border-bottom: 1px solid #3d3d3d;
}

.history-item:hover {
    background-color: #3d3d3d;
}

.history-item.empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 20px;
}

.history-items::-webkit-scrollbar {
    width: 8px;
}

.history-items::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.history-items::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 4px;
}

.modal-footer {
    margin-top: 20px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.view-detailed-log {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.view-detailed-log:hover {
    background-color: #45a049;
}

.view-detailed-log i {
    font-size: 12px;
}

#historyModal .modal-content {
    max-width: 800px;
    width: 90%;
}
