/* ============================================================
   pages.css — Shared styles across pages (base reset + common UI)
   ============================================================ */

/* --- Base reset --- */
* { box-sizing: border-box; }
body {
    font-family: "Roboto","Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;
    font-size: 14px;
    color: #333;
    background: #f8f8f8;
    margin: 0;
    padding: 0;
}

/* --- Common layout --- */
.container { max-width: 1000px; margin: 20px auto; padding: 20px; }
.activity-container { max-width: 900px; margin: 20px auto; padding: 20px; }
.activity-container h1 { margin-top: 0; color: #333; }
.account-container { max-width: 600px; margin: 40px auto; padding: 20px; border-radius: 8px; }
.collection-list { max-width: 800px; margin: 20px auto; padding: 20px; }
.collection-list h1 { margin-top: 0; color: #333; }
.collection-detail { max-width: 800px; margin: 20px auto; padding: 20px; }
.collection-play { max-width: 1000px; margin: 0 auto; padding: 20px; }
.collection-wombs { max-width: 1000px; margin: 20px auto; padding: 20px; }
.collection-header { border-bottom: 1px solid #ccc; padding-bottom: 15px; margin-bottom: 20px; }
.collection-header h1 { margin: 0 0 10px 0; color: #333; }
.collection-header .description { color: #666; font-size: 14px; }

/* --- Loading / error --- */
.loading { text-align: center; padding: 40px; color: #999; font-size: 16px; }
.error-msg { text-align: center; padding: 40px; color: #c62828; font-size: 16px; }
.no-data { color: #999; font-size: 13px; }
.empty-message { color: #666; text-align: center; padding: 40px; }

/* --- Report header --- */
.report-header { display: none; margin-bottom: 12px; font-size: 15px; color: #333; }

/* --- Toast --- */
.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; padding: 10px 24px; border-radius: 6px;
    font-size: 14px; z-index: 2000; display: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.toast.show { display: block; }
.toast.success { background: #2e7d32; }
.toast.error   { background: #c62828; }

/* --- Modal --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: #fff; border-radius: 8px; padding: 24px;
    max-width: 400px; width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.modal-content { max-width: 400px; }
.modal-content-wide { max-width: 960px; width: 100%; }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close {
    background: none; border: none; font-size: 24px; cursor: pointer; color: #999;
}
.modal-body { color: #666; }

/* --- Section title --- */
.section-title {
    font-size: 14px; color: #666; text-transform: uppercase;
    margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #eee;
}

/* --- Section (activity / day_detail) --- */
.section { margin-bottom: 24px; }
.section h3 {
    font-size: 14px; color: #666; text-transform: uppercase;
    margin: 0 0 12px 0; padding-bottom: 8px; border-bottom: 1px solid #eee;
}

/* --- User selector (share bar) --- */
.user-selector { position: relative; display: inline-block; }
.user-selector-btn {
    padding: 8px 16px; background: #fff; border: 1px solid #ddd;
    border-radius: 4px; cursor: pointer; font-size: 14px; color: #333;
    display: flex; align-items: center; gap: 6px;
    min-width: 160px; justify-content: space-between;
}
.user-selector-btn:hover { border-color: #417690; }
.user-selector-btn .arrow { font-size: 10px; color: #999; }
.user-dropdown {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid #ddd; border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100;
    margin-top: 2px; max-height: 250px; overflow-y: auto;
}
.user-dropdown.show { display: block; }
.user-dropdown-item {
    padding: 10px 16px; cursor: pointer; font-size: 14px;
    border-bottom: 1px solid #f0f0f0; transition: background 0.15s;
}
.user-dropdown-item:last-child { border-bottom: none; }
.user-dropdown-item:hover { background: #f0f6ff; }
.user-dropdown-item.active { background: #e3f2fd; color: #1565c0; font-weight: bold; }
.user-dropdown-item .user-type-badge {
    display: inline-block; font-size: 10px; padding: 1px 5px;
    border-radius: 3px; margin-left: 6px;
}
.user-dropdown-item .badge-self    { background: #e8f5e9; color: #2e7d32; }
.user-dropdown-item .badge-shared  { background: #e3f2fd; color: #1565c0; }

/* --- Top bar (activity / collection_list) --- */
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}

/* --- Share link / timezone info --- */
.share-link { color: #417690; text-decoration: none; font-size: 13px; }
.share-link:hover { text-decoration: underline; }
.timezone-info { font-size: 13px; color: #888; margin-bottom: 16px; }
.timezone-info a { color: #417690; }

/* --- Pagination --- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 20px; }
.page-btn {
    padding: 6px 14px; border: 1px solid #ddd; background: #fff;
    border-radius: 4px; cursor: pointer; font-size: 13px; color: #333;
    transition: background 0.2s;
}
.page-btn:hover:not(:disabled) { background: #f0f0f0; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-btn.active { background: #417690; color: #fff; border-color: #417690; }
.page-info { font-size: 13px; color: #666; }

/* --- Rating badges (activity / day_detail) --- */
.rating-badge { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 12px; font-weight: bold; }
.rating-again { background: #fce4ec; color: #c62828; }
.rating-hard  { background: #fff3e0; color: #e65100; }
.rating-good  { background: #e8f5e9; color: #2e7d32; }
.rating-easy  { background: #e3f2fd; color: #1565c0; }
.state-learning   { background: #fff3e0; color: #e65100; }
.state-review     { background: #e8f5e9; color: #2e7d32; }
.state-relearning { background: #fce4ec; color: #c2185b; }

/* --- Rating bar (activity / day_detail) --- */
.rating-bar-row { display: flex; height: 28px; border-radius: 4px; overflow: hidden; margin: 12px 0; }
.rating-bar-seg {
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: bold; color: #fff; transition: width 0.3s;
}
.rating-bar-again { background: #c62828; }
.rating-bar-hard  { background: #e65100; }
.rating-bar-good  { background: #2e7d32; }
.rating-bar-easy  { background: #1565c0; }

/* --- Mini cards / modal grid (activity / day_detail) --- */
.modal-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.modal-grid .mini-card {
    background: #f9f9f9; border: 1px solid #eee; border-radius: 4px;
    padding: 12px 16px; flex: 1; min-width: 100px; text-align: center;
}
.mini-card .val { font-size: 22px; font-weight: bold; color: #333; }
.mini-card .lbl { font-size: 11px; color: #888; margin-top: 2px; }
.modal-section { margin-bottom: 24px; }
.modal-section h3 {
    font-size: 14px; color: #666; text-transform: uppercase;
    margin: 0 0 12px 0; padding-bottom: 8px; border-bottom: 1px solid #eee;
}

/* --- Top SKUs table (activity / day_detail) --- */
.top-skus-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.top-skus-table th {
    text-align: left; padding: 6px 8px; border-bottom: 1px solid #eee;
    color: #888; font-size: 11px; text-transform: uppercase;
}
.top-skus-table td { padding: 6px 8px; border-bottom: 1px solid #f5f5f5; }
.top-skus-table tr:last-child td { border-bottom: none; }
.top-skus-table .rank { color: #999; width: 30px; }

/* --- State transitions (activity / day_detail) --- */
.state-transition-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.state-card {
    background: #fff; border: 1px solid #eee; border-radius: 4px;
    padding: 12px 16px; flex: 1; min-width: 100px; text-align: center;
}
.state-card .val { font-size: 20px; font-weight: bold; }
.state-card .lbl { font-size: 11px; color: #888; margin-top: 2px; }
.state-card.learning   { border-color: #ffe0b2; }
.state-card.review     { border-color: #c8e6c9; }
.state-card.relearning { border-color: #f8bbd0; }

/* --- Hourly bar (activity / day_detail) --- */
.hourly-row   { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.hourly-label { width: 30px; font-size: 11px; color: #888; text-align: right; }
.hourly-bar   { height: 14px; background: #417690; border-radius: 2px; min-width: 2px; transition: width 0.3s; }
.hourly-count { font-size: 11px; color: #666; min-width: 20px; }

/* --- Logs table (activity / day_detail) --- */
.logs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.logs-table th {
    text-align: left; padding: 8px; background: #f5f5f5; border-bottom: 1px solid #ddd;
    font-size: 11px; text-transform: uppercase; color: #888;
}
.logs-table td { padding: 8px; border-bottom: 1px solid #f0f0f0; }
.logs-table tr:last-child td { border-bottom: none; }
.logs-pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; }
.logs-loading { text-align: center; padding: 20px; color: #999; }

/* --- Flex row / col (day_detail) --- */
.flex-row       { display: flex; gap: 24px; flex-wrap: wrap; }
.flex-col       { flex: 1; min-width: 200px; }
.flex-col-wide  { flex: 1; min-width: 250px; }

/* --- Card link (day_detail) --- */
.card-link { color: #417690; cursor: pointer; text-decoration: underline; }
.card-link:hover { color: #2c5f7c; }

/* --- Overlay (day_detail card history) --- */
.overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    align-items: flex-start; justify-content: center; overflow-y: auto;
    padding: 40px 20px;
}
.overlay.active { display: flex; }
.overlay-content {
    background: #fff; border-radius: 8px; max-width: 960px; width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); position: relative;
}
.overlay-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-bottom: 1px solid #eee;
}
.overlay-header h2 { margin: 0; font-size: 18px; }
.overlay-close {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: #999; padding: 0; line-height: 1;
}
.overlay-close:hover { color: #333; }
.overlay-body { padding: 24px; }

/* --- Plans page --- */
.plans-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}
.plans-container h1 {
    margin: 0 0 24px 0;
    font-size: 24px;
    color: #333;
}
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.plan-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s;
}
.plan-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.plan-name {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}
.plan-description {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}
.plan-price {
    margin-bottom: 6px;
}
.price-amount {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}
.price-currency {
    font-size: 14px;
    color: #666;
    margin-left: 2px;
}
.price-usual {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
}
.plan-period {
    font-size: 13px;
    color: #888;
}
.plus-account-descriptions {
    font-size: 15px;
    color: #555;
    margin: 0 0 12px 0;
}
.plus-account-descriptions .login-link-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #1a73e8;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin: 0 4px;
}
.plus-account-descriptions .login-link-btn:hover {
    background: #155db5;
}

/* --- Mobile responsive (shared across pages) --- */
@media (max-width: 600px) {
    .account-container { margin-top: 0; }
    .modal-content { border-radius: 0; max-width: 100%; min-height: 100vh; }
    .modal-grid .mini-card { min-width: calc(50% - 8px); flex: 1 1 calc(50% - 8px); padding: 10px; }
    .mini-card .val { font-size: 18px; }
    .state-card { min-width: 100%; }
    .logs-table, .top-skus-table { display: block; overflow-x: auto; white-space: nowrap; }
    .hourly-label { width: 24px; font-size: 10px; }
    .hourly-count { font-size: 10px; min-width: 16px; }
    .hourly-bar { height: 12px; }
    .page-btn { padding: 4px 10px; font-size: 12px; }
    .page-info { font-size: 11px; }
    .overlay { padding: 0; }
    .overlay-content { border-radius: 0; max-width: 100%; min-height: 100vh; }
    .overlay-header { padding: 12px 16px; }
    .overlay-header h2 { font-size: 16px; }
    .overlay-close { font-size: 28px; padding: 4px; }
    .overlay-body { padding: 16px; }
    .top-bar { flex-direction: column; align-items: stretch; }
    .user-selector-btn { width: 100%; }
    .share-link { text-align: right; }
}