/* styles.css */
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
}

#canvas-container {
    flex: 1;
    width: 100%;
    height: calc(100vh - 60px);
    position: relative;
    overflow: hidden;
    background-color: white;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    image-rendering: crisp-edges;
    object-fit: contain;
    touch-action: manipulation;
}

.controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 8px;
    z-index: 100;
}

.controls button {
    background-color: #333;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
}

.controls button:hover {
    background-color: #555;
}

/* Add styles for CSV selector */
.csv-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

.csv-selector label {
    color: white;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
}

.csv-selector select {
    background-color: #333;
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    min-width: 150px;
}

.csv-selector select:hover {
    background-color: #555;
}

#csv-upload {
    display: none;
}

@media (orientation: portrait) {
    #canvas-container {
        height: calc(100vh - 100px);
    }
    
    .controls {
        bottom: env(safe-area-inset-bottom);
        padding: 8px;
        gap: 6px;
    }
    
    button {
        min-width: 28vw;
        font-size: 3.5vw;
        padding: 2vw 3vw;
    }
}

@media (max-width: 480px) {
    .controls {
        justify-content: space-around;
    }
    
    button {
        min-width: 40%;
        flex-grow: 1;
    }
}

#canvas-container {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
}

.controls {
  position: fixed;
  bottom: 20px;
  width: 100%;
  padding: 0 10px;
  box-sizing: border-box;
}

/* MTRmon Web Styles */
body.mtrmon-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #f8f9fa;
}

.mtrmon-page .main-content {
    padding-top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
}

.mtrmon-page #canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #ffffff;
    overflow: hidden;
    transform-origin: center center;
}

.mtrmon-page canvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    transition: transform 0.3s ease;
}

.mtrmon-page .controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    background: rgba(240, 240, 240, 0.9);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    z-index: 100;
    box-sizing: border-box;
    border-radius: 8px;
}

.mtrmon-page button, .mtrmon-page .csv-selector {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    flex: 0 1 auto;
    text-align: center;
    min-width: fit-content;
}

.mtrmon-page button:hover {
    background: #0056b3;
}

.mtrmon-page #csv-upload {
    display: none;
}

/* Override navbar styles for light theme */
.mtrmon-page .navbar {
    background: rgba(255, 255, 255, 0.9);
}

.mtrmon-page .menu-list a {
    color: var(--text-color);
}

.mtrmon-page .menu-list a:hover,
.mtrmon-page .menu-list a.active {
    color: var(--primary-color);
}

.mtrmon-page .icon {
    color: var(--text-color);
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .mtrmon-page .controls {
        width: 95%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        padding: 1rem;
        left: 50%;
        transform: translateX(-50%);
        bottom: 10px;
    }

    .mtrmon-page button, .mtrmon-page .csv-selector {
        width: auto;
        margin: 0.25rem;
        flex: 0 1 auto;
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .mtrmon-page .menu-list {
        background: rgba(255, 255, 255, 0.9);
    }
    
    .mtrmon-page #canvas-container {
        transform: scale(0.95);
        transform-origin: center center;
    }
}

@media (orientation: portrait) {
    .mtrmon-page #canvas-container {
        width: 100vw;
        height: calc(100vh - 120px);
        transform: scale(0.9);
        transform-origin: center top;
    }
    
    .mtrmon-page .controls {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        bottom: 10px;
    }
    
    .mtrmon-page button, .mtrmon-page .csv-selector {
        margin: 0.25rem;
        width: auto;
        flex: 0 1 auto;
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
    }
    
    .csv-selector label {
        font-size: 0.85rem;
    }
    
    .csv-selector select {
        min-width: 120px;
        font-size: 0.85rem;
        padding: 0.35rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .mtrmon-page .controls {
        justify-content: center;
        padding: 8px;
        gap: 6px;
        width: 98%;
        overflow-x: auto;
        flex-wrap: wrap;
        max-height: 150px;
    }
    
    .mtrmon-page button, .mtrmon-page .csv-selector, .zoom-btn {
        min-width: auto;
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
        margin: 0.2rem;
    }
    
    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
        padding: 0;
    }
    
    .zoom-level {
        font-size: 10px;
        min-width: 30px;
    }
    
    .mtrmon-page #canvas-container {
        transform-origin: center center;
        height: calc(100vh - 140px);
    }
}

/* Additional responsive styles for very small screens */
@media (max-width: 360px) {
    .mtrmon-page .controls {
        padding: 6px 4px;
        gap: 4px;
        bottom: 5px;
    }
    
    .mtrmon-page button, .mtrmon-page .csv-selector {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        margin: 0.15rem;
    }
    
    .csv-selector label {
        font-size: 0.75rem;
    }
    
    .csv-selector select {
        min-width: 100px;
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
    }
    
    .mtrmon-page #canvas-container {
        transform: scale(0.8);
    }
}

/* Phone landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .mtrmon-page #canvas-container {
        transform: scale(0.8);
        height: calc(100vh - 80px);
    }
    
    .mtrmon-page .controls {
        padding: 5px;
        bottom: 5px;
    }
    
    .mtrmon-page button, .mtrmon-page .csv-selector {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Fix for iPhone notch and safe areas */
@supports (padding: max(0px)) {
    .mtrmon-page .controls {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

/* Button group for responsive layout */
.button-group {
    display: flex;
    gap: 5px;
}

/* Responsive styles */
@media (max-aspect-ratio: 9/16) {
    #canvas-container {
        transform: scale(0.85);
        transform-origin: center top;
    }
    
    .controls {
        transform: scale(0.9);
        bottom: 10px;
    }
}

@media (max-width: 600px) {
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .button-group, .csv-selector {
        margin-bottom: 8px;
    }
    
    button {
        font-size: 14px !important;
        padding: 8px 12px !important;
    }
}

/* Zoom controls styles */
.zoom-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.zoom-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.zoom-btn:hover {
    background-color: #0056b3;
}

.zoom-level {
    font-size: 12px;
    color: var(--text-color);
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}