/* =============================================
   ひなしろ見守りん - スマホファーストCSS
   ============================================= */

:root {
    --primary: #FF6B9D;
    --primary-dark: #E85585;
    --primary-light: #FFE0EB;
    --arrival: #4CAF50;
    --arrival-light: #E8F5E9;
    --departure: #2196F3;
    --departure-light: #E3F2FD;
    --danger: #F44336;
    --text: #333;
    --text-light: #777;
    --bg: #FFF5F8;
    --white: #fff;
    --border: #F0E0E5;
    --shadow: 0 2px 8px rgba(255, 107, 157, 0.15);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN',
                 'Noto Sans JP', Meiryo, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 100px;
}

/* Header */
.app-header {
    background: var(--white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.1rem;
    color: var(--primary);
}

.app-header nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-size: 0.85rem;
    color: var(--text-light);
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Auth Card (Login/Register) */
.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    margin-top: 40px;
    box-shadow: var(--shadow);
}

.logo {
    text-align: center;
    margin-bottom: 24px;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary);
}

.subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    outline: none;
}

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

.form-row {
    display: flex;
    gap: 8px;
}

.flex-input {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-full {
    width: 100%;
}

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-large {
    padding: 20px 32px;
    font-size: 1.2rem;
    border-radius: 16px;
    flex: 1;
}

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

.btn-arrival:hover, .btn-arrival:active {
    background: #43A047;
    transform: scale(0.98);
}

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

.btn-departure:hover, .btn-departure:active {
    background: #1E88E5;
    transform: scale(0.98);
}

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

.btn-danger:hover {
    background: #D32F2F;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--primary-dark);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state .btn {
    margin-top: 16px;
}

/* Child Cards - Dashboard */
.children-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.child-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.child-name {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.parent-tag {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-light);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.inline-form {
    display: inline;
    flex: 1;
}

.inline-form .btn {
    width: 100%;
}

/* Child/Family List */
.child-list {
    list-style: none;
}

.child-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.child-list-item:last-child {
    border-bottom: none;
}

.child-list-name {
    font-weight: 600;
}

.member-email {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Invite Code */
.invite-card {
    text-align: center;
}

.invite-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 12px 0;
}

.invite-code-display code {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 8px 16px;
    border-radius: 8px;
    letter-spacing: 3px;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Inline Add Form */
.inline-add-form .form-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.inline-add-form input {
    flex: 1;
}

/* History */
.today-history,
.history-group {
    margin-bottom: 16px;
}

.today-history h2,
.history-date {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.history-list {
    list-style: none;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-item.arrival {
    border-left: 4px solid var(--arrival);
}

.history-item.departure {
    border-left: 4px solid var(--departure);
}

.history-icon {
    font-size: 1.5rem;
}

.history-detail {
    flex: 1;
    font-size: 0.9rem;
}

.history-detail strong {
    color: var(--text);
}

.history-time {
    font-weight: 700;
    margin-left: 8px;
}

.history-user {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    transition: opacity 0.3s, transform 0.3s;
}

.alert-error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

/* Auth Link */
.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.auth-link a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Bottom Navigation */
.bottom-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    z-index: 100;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.7rem;
    padding: 4px 8px;
    transition: color 0.2s;
}

.menu-item.active {
    color: var(--primary);
}

.menu-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

/* Install Banner */
.install-banner {
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}

.install-banner p {
    flex: 1;
}

.install-banner .btn-outline {
    border-color: var(--white);
    color: var(--white);
}

/* Safe area (iPhone notch) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-menu {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    .container {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

/* Responsive - tablet+ */
@media (min-width: 768px) {
    .container {
        max-width: 560px;
    }

    .btn-large {
        font-size: 1.3rem;
        padding: 24px 40px;
    }
}
