/* サイボウズ・Googleカレンダー同期管理UI */

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
}

.badge-running {
    background-color: #28a745;
    color: white;
}

.badge-stopped {
    background-color: #dc3545;
    color: white;
}

.badge-error {
    background-color: #ffc107;
    color: #333;
}

/* メインコンテンツ */
main {
    flex: 1;
    display: grid;
    gap: 24px;
}

.control-panel {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.sync-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-start {
    background-color: #28a745;
    color: white;
}

.btn-start:hover:not(:disabled) {
    background-color: #218838;
}

.btn-stop {
    background-color: #dc3545;
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background-color: #c82333;
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
}

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

.btn-config:hover:not(:disabled) {
    background-color: #0056b3;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* 状態詳細 */
.status-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item label {
    font-weight: 600;
    color: #6c757d;
    font-size: 14px;
}

.detail-item span {
    font-size: 16px;
    color: #333;
}

/* ログパネル */
.log-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

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

.panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.log-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.log-controls select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
}

.log-content {
    height: 400px;
    overflow-y: auto;
    background-color: #f8f9fa;
}

#log-display {
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    background-color: transparent;
}

/* メッセージ */
.message-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.message {
    padding: 16px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* フッター */
footer {
    margin-top: 24px;
    padding: 16px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    border-top: 1px solid #e9ecef;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .status-indicator {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .sync-controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .status-details {
        grid-template-columns: 1fr;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .log-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .message-area {
        position: static;
        margin: 16px 0;
        max-width: none;
    }
}

/* アニメーション */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.badge-running {
    animation: pulse 2s infinite;
}

/* スクロールバー */
.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.log-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.close:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.config-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e9ecef;
}

.config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.config-section h3 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.config-description {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 16px;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.config-group label {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.config-group select {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: white;
    font-size: 14px;
    color: #333;
    transition: border-color 0.2s ease;
}

.config-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400 !important;
    margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #007bff;
}

.current-status {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.current-status h3 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.status-info {
    display: grid;
    gap: 12px;
}

.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-item label {
    font-weight: 500;
    color: #6c757d;
    font-size: 14px;
}

.status-item span {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.modal-footer {
    padding: 20px 24px;
    background-color: #f8f9fa;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #e9ecef;
}

/* モーダルのレスポンシブデザイン */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .config-group {
        gap: 12px;
    }
    
    .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}