/* === Records Page === */
#records-page {
    padding: 16px;
}

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

.back-btn {
    color: white;
    background: linear-gradient(90deg, rgba(255,105,180,0.8), rgba(255,20,147,0.8));
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}
.back-btn:hover { background: linear-gradient(90deg, #ff69b4, #ff1493); }

.records-title {
    font-size: clamp(18px, 3vw, 24px);
    font-weight: bold;
    color: white;
    text-align: center;
}

/* Tabs */
.tab-container { flex: 1; }

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.tab {
    background: rgba(255,255,255,0.7);
    color: var(--text-sub);
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.tab:hover { color: var(--pink); }
.tab.active {
    background: var(--bg-card);
    font-weight: bold;
    color: var(--pink);
    border-bottom: 3px solid var(--pink);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }
#tab-activities.active { width: 100%; }

/* Record Layout */
.record-layout {
    display: flex;
    gap: 12px;
}
@media (max-width: 768px) {
    .record-layout { flex-direction: column; }
}

.form-panel { flex: 0 0 320px; }
.list-panel { flex: 1; display: flex; flex-direction: column; gap: 10px; }

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
}

.form-card {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* Form */
.form-group {
    margin-bottom: 8px;
}
.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-sub);
    margin-bottom: 3px;
}
.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-input);
    transition: border-color 0.2s, background 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--pink);
    background: var(--pink-light);
    outline: none;
}

.readonly-input {
    background: var(--bg) !important;
    color: var(--text-muted) !important;
}

.file-row {
    display: flex;
    gap: 6px;
}
.file-row input { flex: 1; }

.file-btn {
    padding: 8px 14px;
    background: linear-gradient(90deg, #ff69b4, #ff1493);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.file-btn:hover { opacity: 0.85; }

.form-buttons, .media-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* Buttons */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
    flex: 1;
}
.btn:hover { opacity: 0.85; }
.btn-add { background: #4CAF50; }
.btn-update { background: #2196F3; }
.btn-delete { background: #f44336; }
.btn-purple { background: #9C27B0; }
.btn-orange { background: #FF5722; }

/* List */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.list-header h3 { font-weight: bold; color: var(--text); }

.play-all-btn {
    background: linear-gradient(90deg, #9C27B0, #7B1FA2);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.2s, transform 0.15s;
    white-space: nowrap;
}
.play-all-btn:hover { opacity: 0.85; transform: scale(1.03); }

.random-btn {
    background: linear-gradient(90deg, #4CAF50, #388E3C);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.2s, transform 0.15s;
    white-space: nowrap;
}
.random-btn:hover { opacity: 0.85; transform: scale(1.03); }

.search-input {
    width: 100%;
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-radius: 20px;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-input);
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: var(--pink);
    background: var(--pink-light);
    outline: none;
}

.record-list {
    max-height: calc(100vh - 360px);
    overflow-y: auto;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 0;
    border-radius: var(--radius-md);
    margin-bottom: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
}
.list-item:hover {
    border-color: var(--pink);
    background: var(--item-hover);
}
.list-item.selected {
    background: linear-gradient(90deg, #ffe6f0, #ffcce0);
    border: 2px solid var(--pink);
}

.item-color-bar {
    width: 5px;
    min-height: 40px;
    align-self: stretch;
    flex-shrink: 0;
}

.item-inner {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
    flex: 1;
}

.item-icon { font-size: 20px; flex-shrink: 0; }

.item-link-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.item-link-btn:hover {
    background: rgba(255,105,180,0.15);
    transform: scale(1.15);
}

.item-text { flex: 1; min-width: 0; }
.item-title { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.item-sub { font-size: 13px; font-weight: 600; color: var(--text-sub); margin-top: 2px; }

.item-fav-icon { color: var(--pink-dark); font-size: 14px; flex-shrink: 0; }
.item-stars { color: #ffc107; font-size: 12px; letter-spacing: 1px; flex-shrink: 0; margin-left: 4px; }
.status-badge { font-size: 13px; flex-shrink: 0; margin-left: 4px; }
.status-select { padding: 6px 10px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; color: var(--text); background: var(--bg-input); cursor: pointer; }
.status-select:focus { border-color: var(--pink); outline: none; }

.star-rating { display: flex; gap: 2px; }
.star-rating .star { font-size: 22px; cursor: pointer; color: #555; transition: color 0.15s, transform 0.15s; user-select: none; }
.star-rating .star:hover { transform: scale(1.2); }
.star-rating .star.active { color: #ffc107; }
.star-him.active { color: #1976d2 !important; }
.star-her.active { color: #e91e63 !important; }

.dual-rating { display: flex; flex-direction: column; gap: 4px; }
.rating-label { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.rating-label-him { color: #1976d2; }
.rating-label-her { color: #e91e63; }

.item-stars-him { color: #1976d2; }
.item-stars-her { color: #e91e63; }
.item-avg-rating { color: var(--pink-dark); font-size: 12px; font-weight: 700; margin-left: 4px; flex-shrink: 0; }

.rating-row { display: flex; align-items: center; gap: 8px; }
.reason-btn { background: none; border: none; font-size: 18px; cursor: pointer; padding: 2px 4px; border-radius: var(--radius-sm); transition: background 0.2s, transform 0.15s; line-height: 1; }
.reason-btn:hover { background: rgba(255,105,180,0.15); transform: scale(1.15); }

.rating-reason-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: v2ModalFadeIn 0.25s ease; }
.rating-reason-modal { background: var(--bg-card); border-radius: var(--radius-lg); max-width: 440px; width: 90%; box-shadow: 0 16px 48px rgba(0,0,0,0.2); animation: v2ModalScaleIn 0.25s ease; overflow: hidden; }
.rating-reason-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.rating-reason-header h3 { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }
.rating-reason-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; padding: 0; line-height: 1; transition: color 0.2s; }
.rating-reason-close:hover { color: var(--text); }
.rating-reason-body { padding: 8px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.reason-field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.reason-field textarea { width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text); resize: vertical; min-height: 70px; transition: border-color 0.2s, background 0.2s; }
.reason-him label { color: #1565c0; }
.reason-him textarea { border: 2px solid #bbdefb; background: #e3f2fd; }
.reason-him textarea:focus { border-color: #1976d2; background: #e3f2fd; outline: none; }
.reason-her label { color: #c2185b; }
.reason-her textarea { border: 2px solid #f8bbd0; background: #fce4ec; }
.reason-her textarea:focus { border-color: #e91e63; background: #fce4ec; outline: none; }
.rating-reason-footer { display: flex; gap: 8px; padding: 8px 20px 16px; }
.rating-reason-footer .btn { flex: 1; }

.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; color: var(--text-sub); }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--pink); }

mark { background: rgba(255,105,180,0.25); color: inherit; border-radius: 2px; padding: 0 1px; }

.item-detail-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.item-detail-btn:hover {
    background: rgba(100,100,100,0.1);
    transform: scale(1.15);
}

.detail-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: v2ModalFadeIn 0.25s ease; }
.detail-modal { background: var(--bg-card); border-radius: var(--radius-lg); max-width: 480px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 16px 48px rgba(0,0,0,0.2); animation: v2ModalScaleIn 0.25s ease; }
.detail-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.detail-header h3 { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.detail-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; padding: 0; line-height: 1; transition: color 0.2s; }
.detail-close:hover { color: var(--text); }
.detail-body { padding: 4px 20px 20px; }
.detail-image-area { text-align: center; margin-bottom: 12px; }
.detail-image-area img { max-width: 100%; max-height: 300px; border-radius: var(--radius-md); object-fit: contain; }
.detail-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.detail-meta-item { display: flex; gap: 8px; font-size: 14px; color: var(--text-sub); }
.detail-meta-label { font-weight: 600; color: var(--text); min-width: 60px; }
.detail-meta-item a { color: var(--pink); word-break: break-all; }
.detail-rating-area { margin-bottom: 12px; }
.detail-rating-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-rating-him { color: #1976d2; font-size: 16px; }
.detail-rating-her { color: #e91e63; font-size: 16px; }
.detail-rating-avg { color: var(--pink-dark); font-size: 16px; font-weight: 700; }
.detail-reasons { margin-bottom: 12px; }
.detail-reasons-inner { display: flex; flex-direction: column; gap: 8px; }
.detail-reason label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 2px; }
.detail-reason p { font-size: 14px; color: var(--text-sub); margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); }
.detail-reason-him label { color: #1565c0; }
.detail-reason-him p { background: #e3f2fd; border-left: 3px solid #1976d2; }
.detail-reason-her label { color: #c2185b; }
.detail-reason-her p { background: #fce4ec; border-left: 3px solid #e91e63; }
.detail-notes { margin-bottom: 8px; }
.detail-notes-inner label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 2px; color: var(--text); }
.detail-notes-inner p { font-size: 14px; color: var(--text-sub); margin: 0; padding: 8px 10px; background: var(--bg); border-radius: var(--radius-sm); white-space: pre-wrap; }

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--empty-color);
}
.empty-state .empty-icon { font-size: 40px; }
.empty-state .empty-msg { font-size: 16px; font-weight: 600; margin-top: 8px; }
.empty-state .empty-hint { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* Image Preview */
.image-preview-card { text-align: center; display: flex; flex-direction: column; }
.image-preview {
    flex: 1;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--bg);
}
.image-preview.has-image {
    border-style: solid;
    border-color: #ffc0d6;
    background: var(--bg-card);
    padding: 10px;
}
.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}
.preview-placeholder {
    font-size: 14px;
    color: var(--text-muted);
}

/* Audio Player */
.audio-player h4 { font-weight: bold; color: var(--text); margin-bottom: 8px; }
.player-status {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--pink-light);
    padding: 10px;
    color: #d63384;
    font-weight: 500;
    margin-bottom: 6px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40,40,40,0.9);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    z-index: 2000;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* Responsive */
@media (max-width: 768px) {
    .form-panel { flex: none; width: 100%; }
    .record-layout { flex-direction: column; }
}
