/* (c) Copyright 2025 by Muczynski */
:root {
  --bs-primary: #2E7D32; /* Forest Green for buttons, navbar */
  --bs-secondary: #A5D6A7; /* Light Green for secondary elements */
  --bs-body-bg: #F5F5F5; /* Off-White background */
  --bs-body-color: #333333; /* Dark Gray text */
  --bs-warning: #FFCA28; /* Soft Orange for accents */
  --bs-danger: #D32F2F; /* Muted Red for errors */
}

body {
    font-family: 'Century Schoolbook', serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.section {
    border: 1px solid #ccc;
    padding: 1em;
    border-radius: 5px;
    background-color: var(--bs-light);
}

.owner-only {
    display: none;
}

.user-is-owner .owner-only {
    display: block !important;
}

.section.hidden {
    display: none;
}

/* Make nav buttons look less like buttons */
#section-menu .nav-link {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    color: var(--bs-nav-link-color);
    text-align: left;
}

#section-menu .nav-link:hover {
    color: var(--bs-navbar-hover-color);
}

#section-menu .nav-link.active {
    font-weight: bold;
    color: var(--bs-navbar-active-color);
}

.navbar.navbar-dark.bg-primary {
    background-color: var(--bs-primary) !important;
}

/* Username display styling */
#username-display {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    padding: 0.25rem 1rem;
    font-style: italic;
}

/* Force theme colors on key components for reliability */
.btn-primary {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: #fff !important;
}

.btn-primary:hover {
    background-color: var(--bs-primary-rgb, #1b5e20) !important;
    border-color: var(--bs-primary-rgb, #1b5e20) !important;
    color: #fff !important;
}

.btn-secondary {
    background-color: var(--bs-secondary) !important;
    border-color: var(--bs-secondary) !important;
    color: #000 !important;
}

.btn-secondary:hover {
    background-color: #8BC78F !important;
    border-color: #8BC78F !important;
    color: #000 !important;
}

/* Button hover states - use light green instead of grey */
.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-danger:hover,
.btn-outline-warning:hover,
.btn-outline-info:hover,
.btn-outline-dark:hover,
.btn-outline-light:hover {
    background-color: #C8E6C9 !important; /* Light green */
    border-color: #A5D6A7 !important;
}

.btn:hover {
    background-color: #C8E6C9 !important; /* Light green fallback */
}

/* Preserve specific button type colors on hover */
.btn-primary:hover {
    background-color: #1b5e20 !important;
    border-color: #1b5e20 !important;
    color: #fff !important;
}

.btn-danger:hover {
    background-color: #C62828 !important;
    border-color: #C62828 !important;
    color: #fff !important;
}

.alert-danger {
    background-color: var(--bs-danger) !important;
    border-color: var(--bs-danger) !important;
    color: #fff !important;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Book photo thumbnail styles */
.room-photo-thumbnails {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.room-photo-thumbnail {
    position: relative;
    max-width: 300px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.room-photo-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.photo-overlay-btn {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    z-index: 10;
}

.photo-overlay-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.rotate-ccw-btn {
    top: 5px;
    left: 5px;
}

.rotate-cw-btn {
    top: 5px;
    right: 5px;
}

.delete-btn {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.edit-btn {
    bottom: 5px;
    left: 40px;
}

.move-left-btn {
    bottom: 5px;
    left: 5px;
}

.move-right-btn {
    bottom: 5px;
    right: 5px;
}

/* Responsive adjustments for thumbnails */
@media (max-width: 768px) {
    .room-photo-thumbnails {
        flex-direction: column;
        align-items: center;
    }

    .room-photo-thumbnail {
        max-width: 90%; /* Use percentage for better responsiveness */
    }
}

@media (min-width: 769px) {
    .room-photo-thumbnails {
        flex-direction: row;
    }
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .navbar-collapse {
        width: 100%;
    }
    .navbar-nav {
        background-color: var(--bs-primary);
        padding: 1rem;
        border-radius: 0.25rem;
        margin-top: 0.5rem;
    }

    #section-menu .nav-link {
        color: rgba(255, 255, 255, 0.75);
        padding: 0.5rem 0;
    }

    #section-menu .nav-link:hover,
    #section-menu .nav-link.active {
        color: #fff;
    }

    .col-md-6.offset-md-3 {
        width: 100%;
        margin-left: 0;
    }
}

/* Mobile-specific improvements for phones */
@media (max-width: 768px) {
    /* Smaller font sizes for mobile */
    body {
        font-size: 13px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    h4, h5, h6 {
        font-size: 1rem;
    }

    /* Remove container left/right whitespace */
    .container {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    /* Remove section left/right whitespace */
    .section {
        padding: 1rem 2px;
    }

    /* Larger touch targets for buttons */
    .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
        font-size: 13px;
    }

    /* Stack buttons vertically on very small screens */
    .btn + .btn {
        margin-top: 0.5rem;
    }

    /* Override horizontal margins for stacked buttons */
    .btn.ms-2, .btn.ms-3 {
        margin-left: 0 !important;
    }

    /* Fix btn-group stacking on mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        margin-top: 0;
    }

    .btn-group .btn + .btn {
        margin-top: 0.5rem;
        margin-left: 0;
    }

    /* Better spacing for form elements */
    .mb-3 {
        margin-bottom: 1.5rem !important;
    }

    /* Larger touch targets for form controls */
    .form-control, .form-select {
        min-height: 44px;
        font-size: 14px; /* Prevents zoom on iOS */
    }

    .form-label {
        font-size: 13px;
    }

    /* Better spacing for action buttons in tables */
    table .btn {
        margin-bottom: 0.25rem;
        font-size: 12px;
        padding: 0.25rem 0.5rem;
    }

    /* Smaller table text */
    table {
        font-size: 12px;
    }

    /* Better navbar brand sizing */
    .navbar-brand {
        font-size: 1rem;
    }

    /* Smaller nav links */
    #section-menu .nav-link {
        font-size: 13px;
    }

    /* Ensure modals are properly sized */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Better spacing for alerts */
    .alert {
        font-size: 12px;
        padding: 0.5rem;
    }

    /* Smaller text in various elements */
    p, li, span, div {
        font-size: 13px;
    }
}

#new-room-summary, #new-room-description, #new-author-bio {
    height: 20rem;
}

.author-photo-thumbnail {
    display: inline-block;
    vertical-align: middle;
}

[data-test="author-photo-cell"] {
    vertical-align: middle;
}

/* Login page split layout */
#login-form .row {
    margin: 0;
}

#login-form .col-md-6 {
    padding: 0;
}

/* Mobile responsiveness for login page */
@media (max-width: 767.98px) {
    #login-form .col-md-6:first-child {
        min-height: 200px !important;
    }

    #login-form .col-md-6:last-child {
        min-height: auto !important;
        padding: 2rem 1rem !important;
    }
}
