/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
header {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    color: #2c3e50;
    font-size: 24px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ボタン */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* 共有保存ボタンを赤色に */
#remoteSaveBtn {
    background-color: #e74c3c;
}

#remoteSaveBtn:hover {
    background-color: #c0392b;
}

/* サイトグリッド */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.site-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.site-header h3 {
    font-size: 18px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-date {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: normal;
}

.delete-site {
    background: none;
    border: none;
    font-size: 24px;
    color: #e74c3c;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.delete-site:hover {
    background-color: #fee;
}

/* ステータス */
.site-status {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
}

.status-not-started {
    background-color: #ecf0f1;
    color: #7f8c8d;
}

.status-in-progress {
    background-color: #fef9e7;
    color: #f39c12;
}

.status-completed {
    background-color: #eafaf1;
    color: #27ae60;
}

/* サイト情報 */
.site-info {
    margin-bottom: 15px;
}

.site-info > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.label {
    color: #7f8c8d;
    font-size: 14px;
}

.value {
    font-weight: 500;
}

.value.overdue {
    color: #e74c3c;
    font-weight: bold;
}

/* サイト名編集 */
.site-name {
    font-size: 18px;
    color: #2c3e50;
    cursor: text;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    min-width: 120px;
    outline: none;
}

.site-name:hover {
    background-color: #f0f0f0;
}

.site-name:focus {
    background-color: #fff;
    border: 2px solid #3498db;
}

.site-name:empty::before {
    content: "サイト名を入力";
    color: #999;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.site-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* メモ入力エリア */
.site-memo {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    position: relative;
}

.memo-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    line-height: 1.5;
}

.memo-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.auto-save-indicator {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 10px;
    color: #27ae60;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auto-save-indicator.show {
    opacity: 1;
}

.save-memo {
    width: 100%;
    padding: 6px 12px;
    font-size: 12px;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* カレンダーポップアップ */
.calendar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-popup {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h3 {
    color: #2c3e50;
}

.close-calendar {
    background: none;
    border: none;
    font-size: 28px;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-calendar:hover {
    background-color: #f5f7fa;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-day:hover {
    background-color: #f5f7fa;
    transform: scale(1.05);
}

.calendar-day.checked {
    background-color: #eafaf1;
    border-color: #27ae60;
}

.calendar-day.today {
    border-color: #3498db;
    border-width: 2px;
}

.calendar-day:active {
    transform: scale(0.95);
}

.calendar-stats {
    display: flex;
    justify-content: space-around;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification-info {
    background-color: #3498db;
}

.notification-success {
    background-color: #27ae60;
}

.notification-error {
    background-color: #e74c3c;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 5px;
    }
    
    .calendar-day {
        font-size: 12px;
    }
}

/* 統合UI：ステータス行 */
.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.status-dropdown {
    flex: 1;
    padding: 6px 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

.quick-btns {
    display: flex;
    gap: 4px;
}

.quick-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all .2s;
}

.quick-btn.done {
    border-color: #27ae60;
    color: #27ae60;
}

.quick-btn.half {
    border-color: #f39c12;
    color: #f39c12;
}

.quick-btn.reset {
    border-color: #95a5a6;
    color: #95a5a6;
}

.quick-btn:hover {
    transform: scale(1.1);
}

/* 進捗バー */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    transition: width .3s ease;
}

/* インタラクティブ進捗バー */
.progress-bar.interactive {
    position: relative;
    height: 24px;
    background: #ecf0f1;
    border-radius: 12px;
    overflow: visible;
    cursor: grab;
    margin-bottom: 12px;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 12px;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #fff;
    border: 3px solid #3498db;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.progress-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(0.95);
}

.progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    color: #2c3e50;
    pointer-events: none;
    text-shadow: 0 0 2px rgba(255,255,255,0.8);
}

.progress-bar.interactive:active {
    cursor: grabbing;
}

.progress-bar.interactive:active .progress-handle {
    cursor: grabbing;
}

/* バックアップドロップダウン */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 120px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 4px;
    overflow: hidden;
}

.dropdown-content a {
    color: #333;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
    background-color: #f5f7fa;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* フローティング連絡事項 */
.floating-notes {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 200px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    resize: both;
    overflow: hidden;
    min-width: 200px;
    min-height: 150px;
}

.floating-notes.hidden {
    display: none;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #3498db;
    color: #fff;
    border-radius: 8px 8px 0 0;
    cursor: move;
}

.notes-header span {
    font-weight: bold;
    font-size: 16px;
}

.close-notes {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-notes:hover {
    background-color: rgba(255,255,255,0.2);
}

.notes-content {
    flex: 1;
    position: relative;
}

.notes-content textarea {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    padding: 15px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    background: linear-gradient(-45deg, #ddd 50%, transparent 50%);
}

/* ドラッグ中のスタイル */
body.dragging {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.dragging-notes {
    opacity: 0.8;
    cursor: move;
}

/* インライン日付 */
.inline-date {
    padding: 4px 6px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}