:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cbe;
    --light-color: #f5f7fa;
    --dark-color: #333;
    --gray-color: #888;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --accent-color: #6b8cbe;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

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

header {
    background-color: white;
    box-shadow: var(--box-shadow);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

header h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

nav {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    padding-left: 20px;
}

nav a {
    text-decoration: none;
    color: var(--dark-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

nav a.active, nav a:hover {
    background-color: var(--primary-color);
    color: white;
}

main {
    min-height: calc(100vh - 200px);
}

.form-section, .history-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

input, textarea, button {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #3a5a8c;
}

.file-upload {
    position: relative;
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    pointer-events: none;
}

.file-btn {
    width: 100%;
    display: inline-block;
    white-space: normal;
    word-wrap: break-word;
}

.records-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

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

.month-header {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: var(--primary-color);
    padding-bottom: 5px;
    border-bottom: 2px solid var(--accent-color);
}

.record-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: stretch;
    gap: 15px;
    min-height: 80px;
}

.record-date, .record-weight, .record-note, .record-photo {
    display: flex;
    align-items: center;
    min-height: 50px;
}

.record-date {
    width: 80px;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
    color: var(--primary-color);
    flex-shrink: 0;
    justify-content: center;
}

.record-weight {
    width: 100px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary-color);
    flex-shrink: 0;
    justify-content: center;
}

.record-photo {
    width: 140px;
    border-radius: 4px;
    flex-shrink: 0;
    overflow: hidden;
    justify-content: center;
}

.record-photo img {
    height: 24px;
    width: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.load-image-btn {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    padding: 0px;
    font-size: 0.8rem;
    color: var(--dark-color);
    line-height: 1.5;
    transition: all 0.3s ease;
    min-height: 50px;
    height: 100%;
    align-self: stretch;
    white-space: normal;
    word-break: break-word;
}

.load-image-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.record-note {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    padding: 0.5rem;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    line-height: 1.5;
    min-height: 50px;
    white-space: normal;
    word-break: break-word;
}

.photo-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
}

.no-records {
    text-align: center;
    padding: 2rem;
    color: var(--gray-color);
    font-style: italic;
}

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

.modal.visible {
    display: block;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.8);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#modalImg {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.modal-btn {
    width: 100%;
    margin-bottom: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
}

.camera-modal {
    padding: 1rem;
}

#cameraPreview {
    width: 100%;
    background-color: #000;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.camera-controls {
    display: flex;
    gap: 1rem;
}

@media (max-width: 768px) {
    .record-card {
        flex-wrap: nowrap;
        gap: 5px;
        padding: 8px;
        min-height: 60px;
        align-items: flex-start;
    }
    
    .record-date {
        width: 32px;
        font-size: 0.6rem;
    }
    
    .record-weight {
        width: 40px;
        font-size: 0.6rem;
    }
    
    .record-photo {
        width: 30px;
    }
    
    .load-image-btn,
    .record-note {
        height: auto;
        /*min-height: 40px;*/
        font-size: 0.6rem;
        padding: 0px;
    }
}

@media (max-width: 480px) {
    .record-date,
    .record-weight {
        width: 28px;
        font-size: 0.5rem;
    }
    
    .record-photo {
        width: 24px;
    }
    
    .load-image-btn,
    .record-note {
        font-size: 0.5rem;
        padding: 0px;
    }
}