/* 基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* ヘッダー */
header {
    text-align: center;
    padding: 40px 20px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 40px;
}

header h1 {
    font-size: 3em;
    color: #2c3e50;
    margin-bottom: 10px;
}

.header-link {
    text-decoration: none;
    color: inherit;
}

.header-link:hover {
    color: #3498db;
}

.subtitle {
    font-size: 1.2em;
    color: #7f8c8d;
}

.main-nav {
    margin-top: 20px;
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.main-nav a:hover {
    background-color: #eaf4ff;
    color: #3498db;
}

.user-info {
    margin-top: 15px;
    font-size: 0.9em;
    color: #555;
}

.user-info .admin-link {
    margin-left: 15px;
    color: #3498db;
    text-decoration: none;
}

.user-info .admin-link:hover {
    text-decoration: underline;
}

/* メインコンテンツ */
main {
    padding: 20px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    color: #555;
    margin-bottom: 20px;
}

.breadcrumbs a {
    color: #3498db;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #95a5a6;
}

.breadcrumb-current {
    font-weight: 600;
    color: #2c3e50;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.9em;
}

/* フォーム */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-group-inline {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-group-inline input,
.form-group-inline select {
    flex: 1;
}

/* インラインフォームの入力高さをボタンと合わせる */
.form-group-inline input[type="text"],
.form-group-inline input[type="email"],
.form-group-inline input[type="number"],
.form-group-inline select {
    height: 36px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.form-actions-inline {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.inline-form {
    display: inline-block;
    width: 100%;
}

/* ユーザー名設定画面 */
.username-form-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px;
    background-color: #fafafa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.username-form {
    margin-top: 20px;
}

/* ページヘッダー */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.page-header h2 {
    color: #2c3e50;
    margin: 0;
}

/* 投票セット一覧 */
.vote-sets-container {
    margin-bottom: 40px;
}

.vote-sets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.vote-set-card {
    padding: 20px;
    background-color: #f6f9ff;
    border-radius: 8px;
    border: 1px solid #d2def2;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.vote-set-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.vote-set-card h3 {
    margin-bottom: 10px;
}

.vote-set-card h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.vote-set-card h3 a:hover {
    color: #3498db;
}

.vote-set-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.vote-set-badges {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 0.9em;
    border-radius: 12px;
    text-decoration: none;
    border: 1px solid transparent;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-secondary {
    background-color: #eef2f7;
    color: #2c3e50;
    border-color: #d1d8e5;
}

.badge-secondary:hover {
    background-color: #e2e8f0;
}

.badge-danger {
    background-color: #ffe5e5;
    color: #c0392b;
    border-color: #f5c2c7;
}

.badge-danger:hover {
    background-color: #ffd6d6;
}

.badge-form {
    margin: 0;
}

.vote-set-description {
    color: #555;
    margin-bottom: 10px;
}

.vote-set-meta {
    font-size: 0.9em;
    color: #7f8c8d;
}

.created-date {
    display: block;
}

/* 投票セット詳細 */
.vote-set-detail-container {
    margin-bottom: 40px;
}

.vote-set-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.vote-set-header h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.vote-set-actions {
    margin-top: 15px;
}

/* 投票カード */
.polls-container {
    margin-top: 30px;
}

.poll-card {
    padding: 25px;
    background-color: #f6f9ff;
    border-radius: 8px;
    border: 1px solid #d2def2;
    margin-bottom: 30px;
}

.poll-question {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
}

/* 投票フォーム */
.poll-form {
    margin-top: 20px;
}

.poll-options {
    margin-bottom: 20px;
}

.option-radio {
    display: block;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.option-radio:hover {
    border-color: #3498db;
    background-color: #f0f8ff;
}

.option-radio input[type="radio"] {
    margin-right: 10px;
}

.option-radio input[type="radio"]:checked + span {
    font-weight: bold;
    color: #3498db;
}

/* 投票結果 */
.poll-results {
    margin-top: 20px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 20px;
}

.results-chart {
    margin-bottom: 0;
    height: 100%;
    min-height: 260px;
}

.results-details {
    margin-top: 0;
}

.results-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.result-item {
    padding: 10px;
    margin-bottom: 8px;
    background-color: #fff;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.total-votes {
    background-color: #f4fbf6;
    border-left-color: #2ecc71;
}

.result-label {
    font-weight: bold;
    font-size: 1em;
    color: #2c3e50;
    margin-bottom: 5px;
}

.result-count {
    color: #3498db;
    font-size: 1em;
    margin-bottom: 6px;
}

.result-voters {
    font-size: 0.85em;
    color: #555;
    margin-top: 6px;
}

.voter-name {
    color: #3498db;
}

.user-vote-info {
    margin-top: 20px;
    padding: 15px;
    background-color: #e8f5e9;
    border-radius: 4px;
    border-left: 4px solid #4caf50;
}

.user-vote-info p {
    margin: 0;
    color: #2c3e50;
}

.user-vote-summary .result-count {
    color: #2c3e50;
    font-weight: bold;
}

.user-vote-summary {
    background-color: #fef6e4;
    border-left-color: #f39c12;
}

.revote-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    width: 100%;
    grid-column: 1 / -1;
}

/* 投票セット作成・編集 */
.create-vote-set-container,
.edit-vote-set-container {
    margin-bottom: 40px;
}

.edit-section {
    padding: 25px;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e3e8ef;
    margin-bottom: 30px;
}

.edit-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.edit-section h4 {
    color: #34495e;
    margin-top: 20px;
    margin-bottom: 15px;
}

.polls-edit-list {
    margin-top: 30px;
}

.poll-edit-card {
    padding: 25px;
    background-color: #f6f9ff;
    border-radius: 8px;
    border: 1px solid #d2def2;
    margin-bottom: 30px;
}

.poll-highlight {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.35);
    transition: box-shadow 0.3s;
}

.poll-edit-form {
    margin-bottom: 20px;
}

.options-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.options-list,
.option-items-list {
    list-style: none;
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.option-item {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background-color: #fdfefe;
    border-radius: 6px;
    border: 1px solid #d8e2dc;
    width: calc(50% - 5px);
    min-width: 260px;
    box-sizing: border-box;
}

.option-item span {
    flex: 1 1 auto;
    word-break: break-word;
    display: block;
    font-size: 0.95em;
    line-height: 1.4;
}

.option-item form {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    width: auto;
}

.option-item .btn-danger {
    padding: 6px 10px;
    font-size: 0.9em;
    white-space: nowrap;
}

.poll-edit-card .option-item form.inline-form {
    max-width: 60px;
}

.option-set-card .option-item form.inline-form {
    width: 100%;
    max-width: none;
}

.option-item .form-group-inline {
    width: 100%;
}

.empty-message {
    color: #7f8c8d;
    font-style: italic;
    margin-top: 10px;
}

/* 管理画面 */
.admin-container {
    margin-bottom: 40px;
}

.option-sets-list {
    margin-top: 30px;
}

.option-set-card {
    padding: 25px;
    background-color: #f4fbf6;
    border-radius: 8px;
    border: 1px solid #cdebd6;
    margin-bottom: 30px;
}

.option-set-form {
    margin-bottom: 20px;
}

.option-items-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

/* フッター */
footer {
    text-align: center;
    padding: 20px;
    border-top: 2px solid #e0e0e0;
    margin-top: 40px;
    color: #7f8c8d;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .container {
        padding: 10px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .vote-sets-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .option-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
