/* Modern BNG-focused styling */
:root {
    --primary-color: #2ecc71;
    --secondary-color: #27ae60;
    --accent-color: #16a085;
    --text-color: #2c3e50;
    --light-bg: #ecf0f1;
    --dark-bg: #2c3e50;
    --panel-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --nav-height: 60px;
}

/* Top Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background-color: var(--panel-bg);
    box-shadow: var(--shadow);
    z-index: 1000;
}

.nav-container {
    max-width: 99%;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-color);
}

.brand-icon {
    font-size: 1.5em;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Adjust main content to account for fixed nav */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--light-bg);
    padding-top: var(--nav-height);
}

#viewDiv {
    position: absolute;
    top: var(--nav-height);
    right: 0;
    bottom: 0;
    left: 0;
}

/* Left Panel Styling */
#leftPanel {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    width: 600px;
    background-color: var(--panel-bg);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--secondary-color);
}

.panel-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
}

.toggle-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px 0px;
    border-radius: var(--border-radius);
    transition: background-color 0.3s;
}

.toggle-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.panel-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    width: 95%;
}

/* Layer Cards Styling */
.layer-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.layer-card:hover {
    transform: translateY(-2px);
}

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

.layer-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.1em;
}

/* Switch Styling */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Opacity Controls Styling */
.opacity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.opacity-control label {
    font-size: 0.9em;
    color: var(--text-color);
}

.opacity-slider {
    flex-grow: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.opacity-value {
    min-width: 40px;
    text-align: right;
    font-size: 0.9em;
    color: var(--text-color);
}

/* Right Panel Styling */
#sidebar {
    position: absolute;
    top: var(--nav-height);
    right: 0;
    bottom: 0;
    width: 315px;
    background-color: var(--panel-bg);
    box-shadow: var(--shadow);
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: center;
    border-bottom: 2px solid var(--secondary-color);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

.sidebar-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Action Buttons Styling */
.action-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    margin: 5px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
    width: calc(100% - 10px);
}

.action-button:hover {
    background-color: var(--secondary-color);
}

.action-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Results Panel Styling */
.results-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 20px;
    box-shadow: var(--shadow);
}

.results-panel h3 {
    color: var(--text-color);
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.metric-section {
    background: var(--light-bg);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
}

.metric-section h3 {
    color: var(--text-color);
    margin-top: 0;
    font-size: 1.1em;
}

.protected-site-present {
    color: #e74c3c;
    font-weight: bold;
}

/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 15px;
    background-color: var(--light-bg);
    border-radius: 8px;
    overflow: hidden;
}

.collapsible-section .section-header {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary-color);
    color: white;
}

.collapsible-section .section-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.collapsible-section .section-header .toggle-icon {
    transition: transform 0.3s ease;
}

.collapsible-section.collapsed .section-header .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible-section .section-content {
    padding: 10px;
    display: none;
}

.collapsible-section:not(.collapsed) .section-content {
    display: block;
}

.collapsible-section .layer-card {
    margin-bottom: 10px;
    background-color: white;
    border-radius: 6px;
    padding: 10px;
}

.collapsible-section .layer-card:last-child {
    margin-bottom: 0;
}

.collapsible-section .opacity-control {
    margin-top: 8px;
    padding: 0 5px;
}

.collapsible-section .opacity-control input[type="range"] {
    width: 100%;
    margin: 5px 0;
}

.collapsible-section .opacity-value {
    display: block;
    text-align: right;
    font-size: 0.8em;
    color: var(--text-color);
}

/* Search Widget Styling */
.esri-search {
    box-shadow: var(--shadow) !important;
    border-radius: var(--border-radius) !important;
}

.esri-search__input {
    border-radius: var(--border-radius) !important;
    border: 1px solid #ddd !important;
}

.esri-search__submit-button {
    background-color: var(--primary-color) !important;
    border-radius: 0 var(--border-radius) var(--border-radius) 0 !important;
}

/* Collapsed Panel State */
#leftPanel.collapsed {
    width: 40px;
}

#leftPanel.collapsed .panel-content,
#leftPanel.collapsed .panel-header h2 {
    display: none;
}

#leftPanel.collapsed .toggle-button {
    transform: rotate(180deg);
}

/* Layer Grid */
.layer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
    padding-right: 20px;
}

/* Layer Cards */
.layer-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Make OS Layers, Land Cover, and Protected Sites sections full width */
.layer-grid > .collapsible-section {
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 10px;
}

/* Layer Controls */
.layer-controls {
    width: 100%;
    margin-top: 20px;
}

.layer-controls .collapsible-section {
    width: 100%;
    margin-bottom: 20px;
}

.layer-controls .section-content {
    padding: 15px;
}

.layer-controls .basemap-chooser,
.layer-controls .legend-widget {
    width: 100%;
    margin-bottom: 15px;
}

.layer-controls .basemap-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    color: #333;
}

.layer-controls .basemap-select:focus {
    outline: none;
    border-color: #0079c1;
    box-shadow: 0 0 0 2px rgba(0, 121, 193, 0.2);
}

#toolbar {
    margin-bottom: 20px;
}

.basemap-chooser, .legend-widget {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 4px;
}

.basemap-chooser label, .legend-widget label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

#legend {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Style the legend items */
#legend .esri-legend__service {
    padding: 0;
    margin: 0;
}

#legend .esri-legend__layer {
    margin-bottom: 8px;
}

#legend .esri-legend__layer-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

#legend .esri-legend__layer-caption {
    color: #666;
    font-size: 12px;
}

#legend .esri-legend__layer-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

#legend .esri-legend__symbol {
    margin-right: 8px;
}

#legend .esri-legend__label {
    font-size: 12px;
    color: #333;
}

.basemap-chooser, .layer-toggle {
    margin-bottom: 10px;
}

.basemap-chooser:last-child, .layer-toggle:last-child {
    margin-bottom: 0;
}

#legend {
    max-height: 300px;
    overflow-y: auto;
}

.metric-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.metric-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1em;
}

.protected-site-present {
    color: #e74c3c;
    font-weight: bold;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--panel-bg);
    margin: auto;
    padding: 0;
    width: 80%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-modal {
    font-size: 1.8em;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.close-modal:hover {
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    color: var(--text-color);
}

.modal-body h3 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-body ul {
    padding-left: 20px;
    margin: 10px 0;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.modal-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.modal-link:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

.link-icon {
    font-size: 1.2em;
}

/* Update nav-link active state */
.nav-link.active {
    background-color: var(--primary-color);
    color: white;
    pointer-events: none;
}

.nav-link:not(.active) {
    cursor: pointer;
}

.instruction-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
}

.instruction-section h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.instruction-section ul {
    margin: 0;
    padding-left: 20px;
}

.instruction-section li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.instruction-section ul ul {
    margin-top: 5px;
    margin-bottom: 5px;
}

.welcome-message {
    text-align: center;
    margin-bottom: 20px;
}

.welcome-message p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.welcome-actions {
    text-align: center;
    margin-top: 20px;
}

#acceptDisclaimer {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

#acceptDisclaimer:hover {
    background-color: var(--secondary-color);
}

.responsive-warning {
    text-align: center;
    margin-bottom: 20px;
}

.responsive-warning p {
    margin-bottom: 15px;
    line-height: 1.5;
    color: var(--text-color);
}

.responsive-actions {
    text-align: center;
    margin-top: 20px;
}

.responsive-actions .action-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
    text-align: center;
}

.responsive-actions .action-button:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* Media query for responsive warning */
@media (max-width: 768px) {
    #responsiveWarningModal {
        display: flex;
        opacity: 1;
    }
    
    .modal-content {
        width: 90%;
        max-width: 500px;
    }
}

.all-layers-toggle {
    margin-bottom: 20px;
    background-color: var(--light-bg);
    border: 2px solid var(--primary-color);
}

.all-layers-toggle .layer-header {
    font-weight: bold;
    color: var(--primary-color);
}

.copyright {
    margin-top: auto;
    padding: 15px;
    text-align: center;
    font-size: 0.8em;
    color: var(--text-color);
    border-top: 1px solid var(--light-bg);
}

.copyright p {
    margin: 0;
}

.net-gain-result {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-top: 10px;
}

.net-gain-result p {
    margin: 8px 0;
    line-height: 1.4;
}

.requirement-met {
    color: var(--primary-color);
    font-weight: bold;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--primary-color);
}

.requirement-not-met {
    color: #e74c3c;
    font-weight: bold;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e74c3c;
}

.basemap-toggle {
    margin-bottom: 20px;
    background-color: var(--light-bg);
    border: 2px solid var(--primary-color);
}

.basemap-toggle .layer-header {
    font-weight: bold;
    color: var(--primary-color);
}

.toggle-card {
    width: 75%;
    margin-bottom: 10px;
    background-color: var(--light-bg);
    border: 2px solid var(--primary-color);
    margin-left: 10px;
}

.toggle-card .layer-header {
    font-weight: bold;
    color: var(--primary-color);
}

.land-cover-legend {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
}

.land-cover-legend h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.1em;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.legend-label {
    font-size: 0.9em;
    color: var(--text-color);
} 