body {
    font-family: 'IM Fell English', serif;
    margin: 0;
    background-color: #f4f4f4;
}

/* Common Layout */
.flex-body {
    display: flex;
    height: 100vh;
}

.centered-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.container {
    text-align: center;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: #343a40;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow-x: hidden;
}

.sidebar.minimized {
    width: 60px;
    padding: 20px 10px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #495057;
    padding-bottom: 10px;
    margin-bottom: 20px;
    min-height: 40px;
}

.sidebar h2 {
    margin: 0;
    white-space: nowrap;
    transition: opacity 0.2s;
    font-size: 1.5rem;
}

.sidebar.minimized h2 {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.minimize-btn {
    background: transparent;
    border: none;
    color: #adb5bd;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
}

.minimize-btn:hover {
    color: white;
    background-color: #495057;
}

.sidebar.minimized .minimize-btn {
    margin: 0 auto;
}

.sidebar a {
    color: white;
    text-decoration: none;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.sidebar.minimized a {
    justify-content: center;
    padding: 10px 0;
}

.sidebar a:hover {
    background-color: #495057;
}

.sidebar svg.icon {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    fill: currentColor;
    flex-shrink: 0;
}

.sidebar.minimized svg.icon {
    margin-right: 0;
}

.sidebar-text {
    transition: opacity 0.2s;
}

.sidebar.minimized .sidebar-text {
    opacity: 0;
    width: 0;
    display: none;
}

.sidebar a.active {
    background-color: #007bff;
}

.sidebar-submenu {
    padding-left: 30px;
}

.sidebar.minimized .sidebar-submenu {
    display: none;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #495057;
    padding-top: 15px;
}

.sidebar.minimized .sidebar-footer form {
    display: flex;
    justify-content: center;
}

.sidebar.minimized .sidebar-footer .btn-full {
    width: auto;
    padding: 10px;
}

.back-home-sidebar {
    margin-top: 15px;
    display: block;
}

/* Main Content Styles */
.main-content {
    flex-grow: 1;
    text-align: left;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.main-content h1 {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #f4f4f4; /* Same as body background */
    padding: 20px 40px;
    margin: 0;
    border-bottom: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
}

/* Other sections should have the side padding */
.main-content > *:not(h1) {
    padding-left: 40px;
    padding-right: 40px;
}

.description-section {
    text-align: left;
    margin-top: 20px;
    margin-bottom: 30px;
    max-width: 800px;
}

.create-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.actions-column {
    text-align: right;
    white-space: nowrap;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

h1 {
    font-size: 1.5rem;
}

h1 svg.icon {
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: middle;
    fill: currentColor;
    margin-right: 10px;
}

.back-home {
    margin-top: 20px;
    display: inline-block;
    color: #6c757d;
    text-decoration: none;
}

.back-home svg.icon {
    width: 1rem;
    height: 1rem;
    vertical-align: middle;
    fill: currentColor;
    margin-right: 5px;
}

/* Home Page Styles */
.home-body {
    background-color: #f4f4f4;
    padding: 60px 20px;
    display: block;
}

.home-container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.home-container h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #2c3e50;
}

.home-actions {
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.home-intro {
    font-size: 1.4rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 60px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 30px;
}

.feature-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: left;
    transition: transform 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-5px);
}

.feature-box h3 {
    margin-top: 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
}

.feature-box h3 svg.icon {
    width: 1.5rem;
    height: 1.5rem;
    fill: #3498db;
}

.feature-box p {
    margin-bottom: 0;
    line-height: 1.5;
    color: #666;
}

/* Attribute Brush Styles */
.attribute-brush-container {
    position: sticky;
    top: 10px;
    float: right;
    margin-right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 200px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.orientation-control-container {
    position: sticky;
    top: 10px;
    left: 10px;
    float: left;
    margin-left: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

.attribute-brush-container h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
}

.attribute-brush-item {
    margin-bottom: 8px;
}

.attribute-brush-item label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 2px;
}

.attribute-brush-checkbox {
    vertical-align: middle;
    margin-right: 5px;
}

.attribute-brush-select {
    width: 100%;
    font-size: 0.75rem;
    padding: 2px;
    border-radius: 3px;
    border: 1px solid #999;
    font-family: 'IM Fell English', serif;
}

.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.zoom-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s, color 0.2s;
    font-family: 'IM Fell English', serif;
}

.zoom-btn:hover {
    background: #e9ecef;
}

.zoom-btn.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

/* Draw Pages Layout */
.draw-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.navigation-area {
    background-color: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.draw-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

.tool-area {
    width: 220px;
    background-color: #f8f9fa;
    border-right: 1px solid #ccc;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#hexpane {
    flex-grow: 1;
    background: #e0e0e0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.scroll-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.scroll-row {
    display: flex;
    gap: 5px;
}

.scroll-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    width: 30px;
    height: 30px;
}

.scroll-btn:hover {
    background: #e9ecef;
}

.scroll-btn svg.icon {
    width: 16px;
    height: 16px;
    margin: 0;
}

.rotate-90 {
    transform: rotate(90deg);
}

.rotate-180 {
    transform: rotate(180deg);
}

.rotate-270 {
    transform: rotate(-90deg);
}

/* Update existing brush and orientation styles for the tool area */
.tool-area .tool-section {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tool-area .tool-section h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #495057;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    font-weight: bold;
}

.tool-area .attribute-brush-container {
    position: static;
    float: none;
    margin: 0;
    width: 100%;
    box-shadow: none;
    background: transparent;
    border: none;
    padding: 0;
}

.tool-area .orientation-control-container {
    position: static;
    float: none;
    margin: 0;
    width: 100%;
    box-shadow: none;
    background: transparent;
    border: none;
    padding: 0;
}

.tool-area .attribute-brush-container h4 {
    display: none;
}

/* Legend Dropdown Styles */
.legend-dropdown {
    position: relative;
    display: inline-block;
}

.legend-dropbtn {
    background-color: #fdfdfd;
    color: #2c3e50;
    padding: 8px 15px;
    font-size: 1rem;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'IM Fell English', serif;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.legend-dropbtn:hover {
    background-color: #f0f0f0;
}

.legend-dropbtn svg.icon {
    width: 1.2rem;
    height: 1.2rem;
}

.legend-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #fff;
    min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 8px;
    border: 1px solid #eee;
    padding: 8px 0;
}

.legend-dropdown-content a {
    color: #2c3e50;
    padding: 10px 15px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s;
}

.legend-dropdown-content a:hover {
    background-color: #f8f9fa;
}

.legend-dropdown:hover .legend-dropdown-content {
    display: block;
}

.legend-item-link canvas {
    border-radius: 3px;
    flex-shrink: 0;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
}

.btn:disabled {
    background-color: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed;
    border: none;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: #ffc107;
    color: black;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.9rem;
    border-radius: 3px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.9rem;
    border-radius: 3px;
}

.btn-full {
    width: 100%;
}

.btn svg.icon {
    width: 1rem;
    height: 1rem;
    vertical-align: middle;
    fill: currentColor;
    margin-right: 5px;
}

/* Form Styles */
.form-container {
    max-width: 800px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    text-align: left;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group label svg.icon {
    margin-right: 5px;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    fill: currentColor;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 300px;
    border-radius: 10px;
    text-align: left;
}

.modal-content h2 svg.icon {
    width: 2rem;
    height: 2rem;
    vertical-align: middle;
    fill: currentColor;
    margin-right: 10px;
}

.modal-content form div {
    margin-bottom: 10px;
}

.modal-content label {
    display: block;
}

.modal-content input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    font-family: inherit;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.details-section h3 svg.icon {
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: middle;
    fill: currentColor;
    margin-right: 10px;
}

.details-section h4 svg.icon {
    width: 1.2rem;
    height: 1.2rem;
    vertical-align: middle;
    fill: currentColor;
    margin-right: 5px;
}

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    stroke-width: 0;
    stroke: currentColor;
    fill: currentColor;
}

/* Area Tree Styles */
.area-tree-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    padding: 20px;
}

.area-tree-container h1 {
    text-align: center;
    margin-bottom: 40px;
}

.world-tree-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.world-tree-section h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    color: #2c3e50;
}

.area-tree ul {
    list-style: none;
    padding-left: 20px;
}

.area-tree .tree-root {
    padding-left: 0;
}

.tree-node {
    margin: 8px 0;
}

.tree-link {
    text-decoration: none;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.tree-link:hover {
    background-color: #f0f0f0;
    color: #007bff;
}

.tree-link svg.icon {
    width: 1rem;
    height: 1rem;
    fill: #3498db;
}

.tree-children {
    border-left: 1px solid #ddd;
    margin-left: 10px;
}

.no-areas-msg {
    font-style: italic;
    color: #888;
}
