* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --navy-blue: #1a3a5f;
    --navy-blue-light: #2a4a6f;
    --light-grey: #e8e8e8;
    --warm-tan: #d4a574;
    --warm-brown: #8b6f47;
    --text-dark: #2c2c2c;
    --text-medium: #555;
}

html {
    zoom: 0.88;
    height: 100%;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.7;
    color: var(--text-dark);
    background-color: var(--light-grey);
    min-height: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Sidebar layout for goat entry pages */
.page-with-sidebar {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(26, 58, 95, 0.15);
    border: 1px solid #d0d0d0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar h3 {
    color: var(--navy-blue);
    font-size: 1.2em;
    margin-bottom: 15px;
    font-weight: 600;
    border-bottom: 2px solid var(--warm-tan);
    padding-bottom: 8px;
}

.prefix-list {
    list-style: none;
}

.prefix-item {
    margin-bottom: 8px;
}

.prefix-link {
    display: block;
    padding: 8px 12px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
}

.prefix-link:hover {
    background-color: rgba(26, 58, 95, 0.1);
    color: var(--navy-blue);
}

.prefix-link.active {
    background-color: var(--navy-blue);
    color: white;
}

.prefix-link.show-all {
    font-weight: 600;
    border-top: 1px solid var(--light-grey);
    padding-top: 12px;
    margin-top: 12px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

header {
    text-align: center;
    padding: 25px 20px;
    background: var(--navy-blue);
    color: white;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 3px 8px rgba(26, 58, 95, 0.2);
    border: 2px solid var(--navy-blue-light);
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    font-weight: 600;
    font-family: 'Georgia', serif;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 1.3em;
    opacity: 0.95;
    font-style: italic;
}

.hero-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 50px;
}

.hero-image {
    flex: 0 0 40%;
    max-width: 40%;
}

.hero-image .image-placeholder {
    width: 100%;
    min-height: 300px;
}

.hero-text {
    flex: 1;
}

.hero-text p {
    color: var(--text-dark);
    line-height: 1.7;
    font-size: 1.21em;
    margin: 0;
}

.hero-images {
    margin-bottom: 50px;
}

.hero-images h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--navy-blue);
    font-size: 2em;
    font-weight: 600;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.image-placeholder {
    background: white;
    border: 2px dashed #b0b0b0;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.image-placeholder p {
    color: var(--text-medium);
    margin: 5px 0;
}

.placeholder-note {
    font-size: 0.85em;
    font-style: italic;
    color: #888;
}

.search-section {
    margin-bottom: 35px;
}

.search-container {
    display: flex;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.1em;
    color: var(--text-dark);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--navy-blue);
    box-shadow: 0 0 0 3px rgba(26, 58, 95, 0.1);
}

.search-input::placeholder {
    color: var(--text-medium);
    font-style: italic;
}

.search-button {
    padding: 15px 30px;
    background: var(--navy-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    white-space: nowrap;
}

.search-button:hover {
    background: var(--navy-blue-light);
    transform: translateY(-2px);
}

.search-button:active {
    transform: translateY(0);
}

.navigation {
    margin-bottom: 20px;
}

.navigation h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--navy-blue);
    font-size: 2em;
    font-weight: 600;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.nav-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-dark);
    box-shadow: 0 2px 6px rgba(26, 58, 95, 0.15);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-align: center;
    border: 2px solid transparent;
}

.nav-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(26, 58, 95, 0.25);
    border-color: var(--warm-tan);
}

.nav-card h3 {
    font-size: 2.4em;
    color: var(--navy-blue);
    font-weight: 600;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-medium);
    font-size: 0.9em;
}

/* Sub-page styles */
.back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--navy-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 4px 8px;
    border-radius: 6px;
}

.back-link:hover {
    color: var(--warm-brown);
    background-color: rgba(26, 58, 95, 0.05);
}


.goat-entry {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 6px rgba(26, 58, 95, 0.15);
    border: 1px solid #d0d0d0;
    transition: opacity 0.3s, display 0.3s;
}

.goat-entry.hidden {
    display: none;
}

.goat-entry h2 {
    color: var(--navy-blue);
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 2px solid var(--warm-tan);
    padding-bottom: 10px;
    font-weight: 600;
}

.goat-images {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.goat-image {
    max-width: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.goat-image-placeholder {
    width: 300px;
    height: 200px;
    background: var(--light-grey);
    border: 2px dashed #b0b0b0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
    font-size: 0.9em;
}

.goat-info {
    margin-bottom: 15px;
}

.goat-info-label {
    font-weight: 600;
    color: var(--navy-blue);
    margin-bottom: 5px;
}

.goat-info-value {
    color: var(--text-dark);
    margin-left: 20px;
}

.goat-info-nested {
    margin-left: 40px;
    color: var(--text-medium);
    font-size: 0.95em;
    margin-top: 5px;
    font-style: italic;
}

.comments {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--warm-tan);
}

.comments-label {
    font-weight: 600;
    color: var(--navy-blue);
    margin-bottom: 8px;
}

.comments-text {
    color: var(--text-dark);
    line-height: 1.7;
}


/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--light-grey);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--warm-brown);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--navy-blue);
}

/* Edit icon styling */
.goat-entry {
    position: relative;
}

.edit-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: var(--navy-blue);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.edit-icon:hover {
    background: var(--navy-blue-light);
    transform: scale(1.1);
}

.edit-icon:active {
    transform: scale(0.95);
}

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 2px solid var(--warm-tan);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--navy-blue);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8em;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--navy-blue);
    font-size: 1em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #d0d0d0;
    border-radius: 6px;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--navy-blue);
}

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

.form-group-nested {
    margin-left: 20px;
    margin-top: 10px;
}

.form-group-nested label {
    font-size: 0.9em;
    color: var(--text-medium);
}

/* Image management section */
.images-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--warm-tan);
}

.images-section h3 {
    color: var(--navy-blue);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.image-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--light-grey);
    border-radius: 8px;
    border: 2px solid #d0d0d0;
}

.image-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #b0b0b0;
}

.image-item-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.image-item-url {
    flex: 1;
    padding: 8px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.9em;
}

.image-item-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--navy-blue-light);
}

.btn-secondary {
    background: var(--warm-brown);
    color: white;
}

.btn-secondary:hover {
    background: var(--warm-tan);
}

.btn-danger {
    background: #c0392b;
    color: white;
}

.btn-danger:hover {
    background: #a93226;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-image-btn {
    margin-top: 10px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--warm-tan);
}

/* Drag handle for reordering */
.drag-handle {
    cursor: move;
    color: var(--text-medium);
    font-size: 20px;
    display: flex;
    align-items: center;
    padding: 0 8px;
}

.drag-handle:hover {
    color: var(--navy-blue);
}

.image-item.dragging {
    opacity: 0.5;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1.1em;
    }

    .hero-content {
        flex-direction: column;
    }

    .hero-image {
        flex: 1;
        max-width: 100%;
    }

    .search-container {
        flex-direction: column;
        padding: 0 10px;
    }

    .search-button {
        width: 100%;
    }

    .nav-grid {
        grid-template-columns: 1fr;
    }

    .goat-image {
        max-width: 100%;
    }

    .page-with-sidebar {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: 300px;
    }

    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        border-radius: 0;
    }

    .image-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .image-item img {
        width: 100%;
        max-width: 200px;
    }
}

