/* Camera Trap Monitor Styles - Based on provided style.css */

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

html {
    overflow-y: scroll;
    height: 100%;
    font: 100%/1.5 sans-serif;
    word-wrap: break-word;
    margin: 0 auto;
    padding: 1.5em;
}

@media (min-width: 768px) {
    html {
        font-size: 125%;
        max-width: 60em; /* Wider for camera trap content */
    }
}

body {
    background-color: #fff;
    color: #333;
    line-height: 1.6;
}

/* Navigation */
nav {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed rgba(45, 90, 61, 0.3);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-container h1 {
    margin: 0;
    font-size: 1.5em;
    color: #2d5a3d;
}

.nav-container h1 a {
    color: inherit;
    text-decoration: none;
}

.nav-container h1 a:hover, .nav-container h1 a:focus {
    text-decoration: none;
    color: #1f4530;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links a {
    color: #2d5a3d;
    text-decoration: none;
    padding: 0.25em 0.5em;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.nav-links a:hover, .nav-links a:focus {
    text-decoration: underline;
    background: rgba(45, 90, 61, 0.1);
}

.nav-links a.active {
    border-color: #2d5a3d;
    background: rgba(45, 90, 61, 0.1);
}

/* Typography */
h1, h2, h3, h4 {
    margin: 2.5rem 0 1.5rem 0;
    line-height: 1.25;
    color: #333;
}

h1.title {
    font-size: 2.5em;
    margin: 1rem 0;
}

h2 {
    font-size: 1.5em;
    margin: 2rem 0 1rem 0;
}

h3 {
    font-size: 1.25em;
    margin: 1.5rem 0 1rem 0;
}

p {
    margin: 1em 0;
    line-height: 1.5;
}

/* Links */
a {
    color: #2d5a3d;
    text-decoration: none;
}

a:hover, a:focus, a:active {
    text-decoration: underline;
}

/* Main content containers */
main {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.hero-section, .content-section {
    margin: 2rem 0;
    padding: 2rem;
    border: 1px dashed rgba(45, 90, 61, 0.3);
    background-color: rgba(200, 200, 200, 0.05);
    border-radius: 6px;
}

.hero-section {
    text-align: center;
    background-color: rgba(45, 90, 61, 0.02);
}

.hero-section .title {
    font-size: 2.5em;
    margin: 0 0 1rem 0;
    color: #2d5a3d;
}

.hero-section .subtitle {
    font-size: 1.2em;
    color: #666;
    margin: 0 0 1.5rem 0;
    font-weight: normal;
    line-height: 1.4;
}

/* Recent photo section */
.recent-photo-section {
    text-align: center;
}

.recent-photo-container {
    position: relative;
    max-width: 800px;
    margin: 2rem auto;
}

.recent-photo-container img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.recent-photo-container img:hover {
    transform: scale(1.02);
}

.photo-info {
    margin-top: 1rem;
    color: #666;
    font-family: monospace;
}

.photo-timestamp {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* Battery status section */
.battery-section h2 {
    color: #333;
    text-align: center;
    margin-bottom: 1.5rem;
}

.battery-container {
    text-align: center;
    margin: 2rem 0;
}

.battery-chart {
    max-width: 100%;
    height: auto;
    border: 1px solid rgba(45, 90, 61, 0.2);
    border-radius: 8px;
    background: white;
    padding: 0.5rem;
    overflow: hidden; /* Prevent chart overflow */
    box-sizing: border-box; /* Include padding in width calculation */
    min-height: 320px; /* Ensure minimum height for mobile */
    position: relative; /* Help with mobile positioning */
}

.battery-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.status-card {
    padding: 1.5rem;
    border: 1px dashed rgba(45, 90, 61, 0.3);
    background-color: rgba(200, 200, 200, 0.05);
    text-align: center;
    border-radius: 6px;
}

.status-card h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1em;
}

.status-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #2d5a3d;
    font-family: monospace;
    margin: 0.5rem 0;
}

.status-label {
    color: #666;
    font-size: 0.9em;
}

/* Gallery styles */
.gallery-controls {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px dashed rgba(45, 90, 61, 0.3);
    background-color: rgba(200, 200, 200, 0.05);
    border-radius: 6px;
}

.date-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.date-navigation input[type="date"] {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
}

.date-navigation button {
    padding: 0.5rem 1rem;
    background-color: #2d5a3d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s ease;
}

.date-navigation button:hover {
    background-color: #1f4530;
}

.date-navigation button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.gallery-stats {
    text-align: center;
    color: #666;
    font-family: monospace;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 2rem 0;
}

.image-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s;
    border: 1px solid rgba(45, 90, 61, 0.1);
}

.image-card:hover {
    transform: translateY(-5px);
}

.image-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
}

.image-info {
    padding: 15px;
}

.image-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
    font-size: 0.9em;
}

.image-date {
    color: #666;
    font-size: 0.8em;
    font-family: monospace;
}

.no-images {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 4rem;
    border: 1px dashed rgba(45, 90, 61, 0.3);
    background-color: rgba(200, 200, 200, 0.05);
    border-radius: 6px;
}

.loading {
    text-align: center;
    color: #2d5a3d;
    padding: 2rem;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    position: relative;
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    top: 50%;
    transform: translateY(-50%);
}

.modal img {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
}

.modal-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    background-color: rgba(0,0,0,0.7);
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 14px;
}

.modal-filename {
    font-weight: bold;
    margin-bottom: 5px;
}

.modal-date {
    font-size: 12px;
    opacity: 0.9;
    font-family: monospace;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 0.75em 1.5em;
    margin: 0.25em 0.5em 0.25em 0;
    border: 1px solid;
    background: transparent;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    vertical-align: top;
    box-sizing: border-box;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.btn-primary {
    border-color: #2d5a3d;
    color: #2d5a3d;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #2d5a3d;
    color: white;
    text-decoration: none;
}

.btn-secondary {
    border-color: #666;
    color: #666;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #666;
    color: white;
    text-decoration: none;
}

/* Status messages */
.status {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.status.loading {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.success {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.hidden {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    html {
        padding: 1rem;
        font-size: 100%;
    }
    
    .nav-container {
        flex-direction: column;
        text-align: center;
    }
    
    .nav-links {
        justify-content: center;
    }
    
    .hero-section, .content-section {
        padding: 1.5rem 1rem;
    }
    
    .hero-section .title {
        font-size: 2em;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .battery-status {
        grid-template-columns: 1fr;
    }
    
    .battery-chart {
        padding-bottom: 1rem; /* Extra padding for mobile x-axis labels */
    }
    
    .date-navigation {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-content {
        max-width: 95%;
    }
    
    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .modal-info {
        bottom: 10px;
        left: 10px;
        right: 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
    }
    
    .image-card img {
        height: 250px;
    }
}