:root {
    --primary-navy: #1a2b4b;
    --accent-gold: #c5a059;
    --bg-light: #f4f7f6;
    --text-dark: #333;
    --text-muted: #666;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    
    /* Progress Colors */
    --status-before: #ff9800; /* 工事前: Orange */
    --status-during: #2196f3;  /* 工事中: Blue */
    --status-completed: #9c27b0; /* 工事完了: Purple */
    --status-finished: #4caf50;   /* 完工: Green */
}

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

body {
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'BIZ UDPGothic', 'Meiryo', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    padding-bottom: 80px; /* Space for FAB */
    -webkit-tap-highlight-color: transparent;
}

header {
    background-color: var(--primary-navy);
    color: var(--white);
    padding: 1.25rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

@media (max-width: 600px) {
    header h1 {
        width: 100%;
        text-align: left;
        margin-bottom: 0.5rem !important;
        font-size: 1.1rem;
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Search Box */
.search-container {
    margin-bottom: 1rem;
}

.search-container input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 25px;
    border: 1px solid #ddd;
    outline: none;
    font-size: 0.95rem;
}

/* Site Cards */
.site-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.site-card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
    border-left: 6px solid var(--primary-navy);
    position: relative;
}

/* Dashboard MyPage additions */
.finished-list .site-card {
    opacity: 0.85;
    filter: grayscale(15%);
    border-left-color: #4caf50;
}

.alert-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
    display:flex;
    align-items:center;
    gap:4px;
}
.alert-badge.blue { background: #3b82f6; }
.alert-badge.orange { background: #f97316; }

/* Site Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.site-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-navy);
}

.last-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.status-before { background-color: var(--status-before); }
.status-during { background-color: var(--status-during); }
.status-completed { background-color: var(--status-completed); }
.status-finished { background-color: var(--status-finished); }

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--primary-navy);
    background-color: #f0f4f8;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.action-btn:hover {
    background-color: #e2e8f0;
}

.action-btn i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-navy);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: none;
    cursor: pointer;
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.05);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 1.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh; /* 画面に収める */
    overflow-y: auto; /* 溢れた場合はスクロール */
}

/* スクロールバーの装飾（任意） */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--primary-navy);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px; /* 16px is required to prevent iOS auto-zoom on focus */
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-navy);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
}

/* Mobile Interaction Fixes */
button, .action-btn, .submit-btn, .util-btn {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

@media (max-width: 600px) {
    .container {
        padding: 0.75rem;
    }
    .submit-btn {
        padding: 1.25rem;
        font-size: 1.1rem;
    }
}
