/* Faylog — Mobile-first CSS */
:root {
    --navy: #1B3A5C;
    --blue: #2E75B6;
    --blue-light: #e8f0fe;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-400: #ced4da;
    --gray-600: #868e96;
    --gray-800: #343a40;
    --white: #ffffff;
    --red: #e03131;
    --green: #2f9e44;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: 16px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--white);
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

/* Login */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 30px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.5px;
}

.login-subtitle {
    text-align: center;
    color: var(--gray-600);
    margin: 4px 0 28px;
    font-size: 14px;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.login-card input:focus { border-color: var(--blue); }

.login-error {
    color: var(--red);
    text-align: center;
    font-size: 13px;
    margin-top: 12px;
}

/* Buttons */
.btn-primary {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    padding: 10px 20px;
    background: var(--gray-100);
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.btn-danger {
    padding: 10px 20px;
    background: var(--white);
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.btn-sm {
    padding: 6px 12px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--navy);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: -0.3px;
}

.header-nav {
    display: flex;
    gap: 4px;
}

.header-nav button {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.header-nav button.active,
.header-nav button:hover {
    color: var(--white);
    background: rgba(255,255,255,0.15);
}

.btn-logout { font-size: 14px !important; }

/* Pages */
.page { padding: 16px; max-width: 640px; margin: 0 auto; }

/* Write page */
.mood-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.mood-btn {
    width: 48px;
    height: 48px;
    font-size: 24px;
    border: 2px solid var(--gray-200);
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-btn.selected {
    border-color: var(--blue);
    background: var(--blue-light);
    transform: scale(1.1);
}

.field-group { margin-bottom: 12px; }

.input-location {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    outline: none;
}
.input-location:focus { border-color: var(--blue); }

.textarea-main {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    resize: none;
    outline: none;
    min-height: 150px;
    line-height: 1.6;
}
.textarea-main:focus { border-color: var(--blue); }

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.action-left { display: flex; gap: 8px; }

.action-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-save {
    padding: 12px 28px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    min-width: 140px;
}
.btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* Tag picker */
.tag-picker {
    margin-top: 12px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.tag-chip {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    background: var(--white);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.tag-chip.selected {
    background: var(--blue);
    color: var(--white);
    border-color: var(--blue);
}

.tag-new {
    display: flex;
    gap: 6px;
}
.tag-new input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    outline: none;
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tag-badge {
    padding: 4px 10px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.tag-badge-sm {
    padding: 2px 8px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 10px;
    font-size: 11px;
}

.pending-photo {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* List page */
.search-bar { margin-bottom: 12px; }
.search-bar input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    outline: none;
}
.search-bar input:focus { border-color: var(--blue); }

.filter-bar {
    margin-bottom: 12px;
}
.filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    outline: none;
}

.note-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.note-card:hover { box-shadow: var(--shadow); }

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.note-date { font-size: 12px; color: var(--gray-600); }
.note-mood { font-size: 18px; }
.note-preview { font-size: 14px; line-height: 1.5; color: var(--gray-800); margin-bottom: 8px; }

.note-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-location { font-size: 12px; color: var(--gray-600); }
.note-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.empty-state {
    text-align: center;
    color: var(--gray-600);
    padding: 40px 0;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
}
.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    cursor: pointer;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Detail page */
.detail-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.detail-content {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    line-height: 1.7;
    margin-bottom: 16px;
    word-break: break-word;
}
.detail-content a { color: var(--blue); text-decoration: underline; }

.detail-links {
    margin-bottom: 16px;
}
.link-item {
    display: block;
    padding: 8px 12px;
    background: var(--blue-light);
    border-radius: 6px;
    margin-bottom: 6px;
    color: var(--blue);
    text-decoration: none;
    font-size: 13px;
}

.detail-attachments { margin-bottom: 16px; }
.attachment-item { margin-bottom: 10px; }
.attachment-img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 4px;
    display: block;
}
.attachment-link {
    font-size: 13px;
    color: var(--blue);
}

.detail-actions {
    display: flex;
    gap: 10px;
}

/* Import page */
.import-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}
.import-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.page-import input[type="file"] {
    margin: 12px 0;
    font-size: 14px;
}

.import-result {
    margin-top: 16px;
    padding: 12px;
    background: var(--blue-light);
    border-radius: 8px;
    font-size: 14px;
}

/* Export page */
.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    max-width: 300px;
}
.export-buttons a {
    text-align: center;
    text-decoration: none;
    display: block;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 4px;
}

/* Responsive adjustments for larger screens */
@media (min-width: 768px) {
    .page { padding: 24px; }
    .textarea-main { min-height: 200px; }
    .login-card { padding: 48px 40px; }
}
