/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #e74c3c;
    --primary-dark: #c0392b;
    --secondary-color: #f39c12;
    --background: #fef9e7;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --error-color: #e74c3c;
    --success-color: #27ae60;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* Login Screen */
.screen {
    min-height: 100vh;
}

#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: var(--card-bg);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    width: 100%;
    max-width: 360px;
}

.login-container h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#password-input {
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

#password-input:focus {
    border-color: var(--primary-color);
}

#login-btn {
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

#login-btn:hover {
    background: var(--primary-dark);
}

#login-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.error-message {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 8px;
}

.lockout-message {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 8px;
    font-weight: 600;
}

/* Dashboard Header */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 24px 20px;
    text-align: center;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.counters {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.counter-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 16px 24px;
    border-radius: 12px;
    min-width: 120px;
}

.counter-icon {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.counter-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.counter-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Timeline */
.timeline {
    padding: 20px;
    padding-bottom: 100px;
    max-width: 600px;
    margin: 0 auto;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 1.1rem;
}

/* Entry Cards */
.entry-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.entry-date {
    font-weight: 600;
    color: var(--text-primary);
}

.entry-count {
    background: var(--secondary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.entry-body {
    padding: 16px;
}

.entry-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.entry-location::before {
    content: "📍";
}

.entry-photo {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.entry-photo:hover {
    opacity: 0.9;
}

.entry-comment {
    color: var(--text-primary);
    font-style: italic;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--secondary-color);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, background 0.2s;
    z-index: 100;
}

.fab:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.fab:active {
    transform: scale(0.95);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: var(--card-bg);
}

.modal-header h2 {
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

#add-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
}

.form-group input[type="file"] {
    font-size: 14px;
}

.photo-preview {
    position: relative;
    margin-top: 12px;
}

.photo-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.remove-photo-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e0e0e0;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* Image Modal */
.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    margin: auto;
}

.image-modal-content .close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
}

#full-image {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
}

/* Desktop styles */
@media (min-width: 768px) {
    .login-container {
        padding: 50px 40px;
    }

    .dashboard-header {
        padding: 32px;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    .counter-box {
        padding: 20px 32px;
        min-width: 150px;
    }

    .counter-number {
        font-size: 3rem;
    }

    .timeline {
        padding: 32px;
    }

    .modal {
        align-items: center;
    }

    .modal-content {
        border-radius: 16px;
        max-height: 80vh;
    }

    .fab {
        bottom: 32px;
        right: 32px;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Edit and Delete buttons */
.entry-edit,
.entry-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s;
}

.entry-edit:hover {
    opacity: 1;
    color: var(--primary-color);
}

.entry-delete:hover {
    opacity: 1;
    color: var(--error-color);
}

.entry-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
