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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: white;
    text-align: center;
    padding: 20px;
}

.login-container h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-container p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.password-input {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: white;
    outline: none;
    transition: all 0.3s;
}

.password-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.password-input:focus {
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.2);
}

.login-button {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255,255,255,0.3);
}

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

.login-error {
    color: #ff6b6b;
    background: rgba(255,107,107,0.2);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    font-weight: 600;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Main App */
#app-screen {
    background: white;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2rem;
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* Record Section */
.record-section {
    text-align: center;
    padding: 3rem 0;
}

.record-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.record-btn.recording {
    background: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 10px 50px rgba(239, 68, 68, 0.8);
    }
}

.record-icon {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    position: relative;
}

.record-btn.recording .record-icon {
    border-radius: 10px;
    width: 50px;
    height: 50px;
}

.record-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.recording-status {
    margin-top: 1rem;
    color: #ef4444;
    font-size: 1.2rem;
    font-weight: 600;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Logs Section */
.logs-section {
    margin-top: 3rem;
}

.logs-section h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.logs-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.log-entry {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-entry:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.log-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.log-entry-date {
    font-weight: 600;
}

.log-entry-time {
    opacity: 0.8;
}

.log-entry-text {
    color: #1f2937;
    font-size: 1.1rem;
    line-height: 1.6;
}

.log-entry.processing {
    opacity: 0.6;
}

.log-entry.processing .log-entry-text {
    font-style: italic;
    color: #6b7280;
}

/* Loading state */
.loading {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
    font-style: italic;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
}

/* Error Modal */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.error-modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.error-modal-content h3 {
    color: #ef4444;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.error-details {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    color: #333;
    font-family: 'Courier New', monospace;
}

.dismiss-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

.dismiss-btn:hover {
    background: #5568d3;
}

.cancel-btn {
    background: #e5e7eb;
    color: #333;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s;
}

.cancel-btn:hover {
    background: #d1d5db;
}

.confirm-delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s;
}

.confirm-delete-btn:hover {
    background: #dc2626;
}

.delete-btn {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #ef4444;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.75rem;
    width: 100%;
}

.delete-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.edit-btn {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #667eea;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.75rem;
    width: 100%;
}

.edit-btn:hover {
    background: #f0f4ff;
    border-color: #667eea;
}

.resubmit-btn {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #10b981;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.75rem;
    width: 100%;
}

.resubmit-btn:hover {
    background: #f0fdf4;
    border-color: #10b981;
}

.log-entry-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 0.5rem;
}

.log-entry-textarea:focus {
    outline: none;
    border-color: #5568d3;
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.save-edit-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s;
}

.save-edit-btn:hover {
    background: #5568d3;
}

.cancel-edit-btn {
    background: #e5e7eb;
    color: #333;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s;
}

.cancel-edit-btn:hover {
    background: #d1d5db;
}

.reviewing {
    background: #fffbeb !important;
    border-left: 3px solid #f59e0b;
}

.log-entry-text.editing {
    display: none;
}

/* Expandable Details */
.log-entry-main {
    cursor: pointer;
    transition: opacity 0.2s;
}

.log-entry-main:hover {
    opacity: 0.8;
}

.expand-indicator {
    color: #667eea;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 500;
    user-select: none;
}

.log-entry-details {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    border-left: 3px solid #667eea;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section strong {
    color: #374151;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
}

.detail-text {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.edit-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.edit-item:last-child {
    margin-bottom: 0;
}

.edit-timestamp {
    color: #6b7280;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.edit-text {
    color: #1f2937;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Camera Button */
.camera-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    margin-left: 2rem;
}

.camera-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.5);
}

.camera-icon {
    font-size: 2rem;
}

.camera-text {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.camera-status {
    margin-top: 1rem;
    color: #10b981;
    font-size: 1.2rem;
    font-weight: 600;
    animation: blink 1s infinite;
}

/* Manual Entry Button */
.manual-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border: none;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
    margin-left: 2rem;
}

.manual-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.5);
}

.manual-icon {
    font-size: 2rem;
}

.manual-text {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Log Entry Image */
.log-entry-image {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Calorie Section */
.calorie-section {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.day-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.current-date {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
}

.calorie-summary {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.calorie-total {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.calorie-label {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.calorie-count {
    color: white;
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Calorie Badge */
.calorie-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

/* Manual Entry Modal */
.manual-entry-modal {
    max-width: 500px;
}

.manual-datetime-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.manual-datetime-input:focus {
    border-color: #667eea;
}

.manual-text-input {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s;
}

.manual-text-input:focus {
    border-color: #667eea;
}

.save-manual-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: background 0.3s;
}

.save-manual-btn:hover {
    background: #5568d3;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .record-btn {
        width: 150px;
        height: 150px;
    }

    .camera-btn {
        width: 100px;
        height: 100px;
        margin-left: 1rem;
        margin-top: 0;
    }

    .manual-btn {
        width: 100px;
        height: 100px;
        margin-left: 1rem;
        margin-top: 0.5rem;
    }

    .record-icon {
        width: 45px;
        height: 45px;
    }

    .camera-icon {
        font-size: 1.5rem;
    }

    .manual-icon {
        font-size: 1.5rem;
    }

    .record-text,
    .camera-text,
    .manual-text {
        font-size: 0.9rem;
    }
}
