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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: #333;
}

/* アプリケーションコンテナ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

/* ヘッダー */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.header-content h1 i {
    margin-right: 10px;
}

.current-time {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

/* 設定セクション */
.settings-section {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.settings-toggle {
    text-align: center;
    margin-bottom: 15px;
}

.settings-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.settings-panel {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.settings-panel.hidden {
    display: none;
}

.input-group {
    margin-bottom: 15px;
}

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

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.save-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.save-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.button-group {
    display: flex;
    gap: 10px;
}

.test-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
}

.test-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

/* チェックボックススタイル */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    padding: 30px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.button-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    max-width: 500px;
}

.clock-button {
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    font-weight: 600;
    border: none;
    position: relative;
    overflow: hidden;
}

.clock-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.clock-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.clock-button:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.clock-button .icon {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.clock-button .button-text {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.clock-button .button-subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: 400;
}

/* ボタンの色分け */
.check-in {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.check-out {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.break-start {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #333;
}

.break-end {
    background: linear-gradient(135deg, #fd7e14 0%, #dc6502 100%);
    color: white;
}

/* ステータスセクション */
.status-section {
    padding: 20px;
    background: #f8f9fa;
}

.status-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

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

.status-card h3 {
    margin: 0;
    color: #495057;
    font-weight: 600;
}

.history-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.history-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

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

.status-label {
    font-weight: 500;
    color: #6c757d;
}

.status-value {
    font-weight: 600;
    color: #495057;
}

/* フッター */
.app-footer {
    background: #343a40;
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 0.9rem;
}

/* ローディング */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 15px;
}

.loading-spinner p {
    margin: 0;
    font-weight: 500;
    color: #495057;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .app-container {
        margin: 0;
        border-radius: 0;
    }
    
    .button-container {
        max-width: 100%;
        gap: 15px;
    }
    
    .clock-button {
        border-radius: 15px;
    }
    
    .clock-button .icon {
        font-size: 2.5rem;
    }
    
    .clock-button .button-text {
        font-size: 1.1rem;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .current-time {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 20px 15px;
    }
    
    .button-container {
        gap: 12px;
    }
    
    .clock-button .icon {
        font-size: 2rem;
    }
    
    .clock-button .button-text {
        font-size: 1rem;
    }
    
    .clock-button .button-subtitle {
        font-size: 0.75rem;
    }
}

/* アニメーション */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-panel {
    animation: slideIn 0.3s ease;
}

/* 履歴パネル */
.history-panel {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.history-panel.hidden {
    display: none;
}

.history-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    margin: 0;
    color: #495057;
    font-weight: 600;
}

.history-controls {
    display: flex;
    gap: 10px;
}

.clear-btn, .export-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.export-btn {
    background: #007bff;
}

.clear-btn:hover {
    background: #c82333;
}

.export-btn:hover {
    background: #0056b3;
}

.history-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px 20px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f4;
}

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

.history-action {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.history-icon.check-in {
    background: #007bff;
    color: white;
}

.history-icon.check-out {
    background: #28a745;
    color: white;
}

.history-icon.break-start {
    background: #ffc107;
    color: #333;
}

.history-icon.break-end {
    background: #fd7e14;
    color: white;
}

.history-details {
    text-align: left;
}

.history-action-name {
    font-weight: 500;
    color: #495057;
}

.history-timestamp {
    font-size: 0.85rem;
    color: #6c757d;
}

.history-time {
    font-weight: 600;
    color: #495057;
    text-align: right;
}

.no-records {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    margin: 0;
    padding: 20px 0;
}

/* フォールバックモーダル */
.fallback-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.fallback-modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideInScale 0.3s ease;
}

.fallback-modal-content h3 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.3rem;
}

.fallback-modal-content p {
    margin: 10px 0;
    color: #6c757d;
    line-height: 1.5;
}

.fallback-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}

.fallback-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.fallback-btn.primary {
    background: #007bff;
    color: white;
}

.fallback-btn.primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.fallback-btn.secondary {
    background: #6c757d;
    color: white;
}

.fallback-btn.secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.fallback-btn:not(.primary):not(.secondary) {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.fallback-btn:not(.primary):not(.secondary):hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.data-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.data-preview details {
    cursor: pointer;
}

.data-preview summary {
    font-weight: 500;
    color: #495057;
    padding: 8px 0;
}

.data-preview pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    overflow-x: auto;
    margin-top: 10px;
}

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* フォーカス可能要素のアクセシビリティ */
.clock-button:focus,
.settings-btn:focus,
.save-btn:focus,
.history-btn:focus,
.clear-btn:focus,
.export-btn:focus,
.test-btn:focus,
.fallback-btn:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}