/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
    background: #f5f0eb;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: #6b4226; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #4a7c59, #6b9a3d);
    color: #fff;
    padding: 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header h1 { font-size: 1.3rem; }
.header a { color: #fff; }

/* ===== Notification Badge ===== */
.notification-bar {
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}
.notification-bar .badge {
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    padding: 0.15rem 0.5rem;
    font-size: 0.8rem;
    margin-right: 0.3rem;
}

/* ===== Container ===== */
.container { max-width: 960px; margin: 0 auto; padding: 1rem; }

/* ===== Filter ===== */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filter-bar select,
.filter-bar input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* ===== Cards ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.card {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s;
    cursor: pointer;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.card-header h3 { font-size: 1.1rem; }
.card-type {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    color: #fff;
    font-weight: bold;
}
.card-type.kabuto { background: #c0392b; }
.card-type.kuwagata { background: #2980b9; }
.card-info { font-size: 0.85rem; color: #666; }
.card-info span { display: inline-block; margin-right: 0.8rem; }
.card-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 0.5rem;
}
.card-status.active { background: #d4edda; color: #155724; }
.card-status.dead { background: #f8d7da; color: #721c24; }
.card-status.transferred { background: #d1ecf1; color: #0c5460; }

/* ===== Form ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}
.btn-primary { background: #4a7c59; color: #fff; }
.btn-primary:hover { background: #3d6a4b; text-decoration: none; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.btn-add {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 50;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-btn {
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    color: #666;
    font-weight: bold;
}
.tab-btn.active { color: #4a7c59; border-bottom-color: #4a7c59; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Detail Page ===== */
.detail-header {
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.detail-header h2 { margin-bottom: 0.3rem; }
.detail-actions { display: flex; gap: 0.5rem; margin-top: 0.8rem; }

/* ===== Table (logs) ===== */
.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.log-table th, .log-table td {
    padding: 0.6rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.log-table th { background: #f8f8f8; font-weight: bold; }

/* ===== Photo Grid ===== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.8rem;
}
.photo-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
}
.photo-item p { font-size: 0.8rem; color: #666; text-align: center; margin-top: 0.3rem; }

/* ===== Inline Form ===== */
.inline-form {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}
.inline-form h4 { margin-bottom: 0.8rem; }

/* ===== Memo ===== */
.memo-item {
    background: #fffde7;
    border-left: 4px solid #ffc107;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 0 6px 6px 0;
}
.memo-item .memo-date { font-size: 0.8rem; color: #999; }

/* ===== Reminder ===== */
.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem;
    border-bottom: 1px solid #eee;
}
.reminder-item.overdue { background: #fff5f5; }

/* ===== Messages ===== */
.msg-success { background: #d4edda; color: #155724; padding: 0.8rem; border-radius: 6px; margin-bottom: 1rem; }
.msg-error { background: #f8d7da; color: #721c24; padding: 0.8rem; border-radius: 6px; margin-bottom: 1rem; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: #999; }
.empty-state p { font-size: 1.1rem; }

/* ===== Delete Btn ===== */
.delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.85rem;
}
.delete-btn:hover { text-decoration: underline; }

/* ===== Header Plan Badge ===== */
.header-plan { margin-top: 0.3rem; }
.plan-badge {
    display: inline-block;
    padding: 0.15rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-decoration: none;
}
.plan-free { background: rgba(255,255,255,0.25); color: #fff; }
.plan-pro { background: #ffd700; color: #333; }
.plan-breeder { background: #ff6b35; color: #fff; }

/* ===== Plan Usage Bar ===== */
.plan-usage {
    background: #e8f5e9;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* ===== Ad Banner ===== */
.ad-banner {
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    padding: 0.5rem 1rem;
}
.ad-content {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}
.ad-label {
    background: #999;
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: bold;
}
.btn-ad-upgrade {
    background: #ff6b35;
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}
.btn-ad-upgrade:hover { background: #e55a2b; text-decoration: none; }

/* ===== Lineage (Blood Line) ===== */
.lineage-section { margin-bottom: 1.5rem; }
.lineage-heading {
    font-size: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #4a7c59;
    margin-bottom: 0.8rem;
    color: #4a7c59;
}
.lineage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}
.lineage-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: transform 0.15s;
}
.lineage-card:hover { transform: translateY(-2px); text-decoration: none; }
.lineage-card.father { background: #e3f2fd; border: 2px solid #90caf9; }
.lineage-card.mother { background: #fce4ec; border: 2px solid #f48fb1; }
.lineage-card.empty { background: #f5f5f5; border: 2px dashed #ccc; color: #999; }
.lineage-role {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    margin-bottom: 0.3rem;
    color: #666;
}
.lineage-name { font-size: 1rem; font-weight: bold; }
.lineage-meta { font-size: 0.8rem; color: #888; margin-top: 0.2rem; }

.lineage-list { display: flex; flex-direction: column; gap: 0.4rem; }
.lineage-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s;
}
.lineage-list-item:hover { background: #f0f8f0; text-decoration: none; }
.lineage-empty { color: #999; font-size: 0.9rem; padding: 0.5rem 0; }

/* ===== Pricing Page ===== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.2rem;
    align-items: stretch;
}
.pricing-card {
    background: #fff;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color 0.2s;
}
.pricing-card.current { border-color: #4a7c59; }
.pricing-current-badge {
    position: absolute;
    top: -0.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: #4a7c59;
    color: #fff;
    padding: 0.15rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
}
.pricing-name {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}
.pricing-price {
    text-align: center;
    margin-bottom: 1rem;
}
.pricing-amount { font-size: 2rem; font-weight: bold; color: #333; }
.pricing-period { font-size: 0.9rem; color: #999; }
.pricing-features {
    list-style: none;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}
.pricing-features li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container { padding: 0.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .header h1 { font-size: 1.1rem; }
    .tabs { gap: 0; }
    .tab-btn { padding: 0.5rem 0.7rem; font-size: 0.8rem; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .lineage-grid { grid-template-columns: 1fr; }
    .pricing-grid { grid-template-columns: 1fr; }
    .ad-content { font-size: 0.8rem; }
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

/* ===== Ad Banner Detail ===== */
.ad-banner-detail {
    margin-top: 1.5rem;
}
