/* ========================================
   コスコマッチ - メインスタイルシート
   ======================================== */

:root {
    --primary: #e4002b;
    --primary-dark: #b8001f;
    --secondary: #003da5;
    --bg: #f5f5f5;
    --white: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #dddddd;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 80px;
}

/* ヘッダー */
.header {
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
}

.header h1 a {
    color: var(--white);
    text-decoration: none;
}

.header-nav {
    display: flex;
    gap: 12px;
}

.header-nav a {
    color: var(--white);
    text-decoration: none;
    font-size: 13px;
    opacity: 0.9;
}

.header-nav a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* メインコンテンツ */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* 注意書きバナー */
.notice-banner {
    background: #fff3cd;
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #856404;
}

.notice-banner strong {
    display: block;
    margin-bottom: 4px;
}

/* エリアセクション */
.area-section {
    margin-bottom: 24px;
}

.area-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
    padding: 8px 0;
    border-bottom: 2px solid var(--secondary);
    margin-bottom: 12px;
}

.store-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.store-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.1s;
}

.store-card:active {
    transform: scale(0.98);
}

.store-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.store-name {
    font-weight: 600;
    font-size: 15px;
}

.store-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--success);
    color: var(--white);
}

.store-badge.coming-soon {
    background: var(--border);
    color: var(--text-light);
}

/* 投稿カード */
.post-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.post-type-badge {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.post-type-badge.buy {
    background: #e3f2fd;
    color: #1565c0;
}

.post-type-badge.share {
    background: #e8f5e9;
    color: #2e7d32;
}

.post-product-name {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

.post-meta {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.post-meta-item {
    display: flex;
    gap: 6px;
}

.post-meta-label {
    font-weight: 600;
    min-width: 80px;
}

.post-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* フォーム */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-label .required {
    color: var(--danger);
    margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(228, 0, 43, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* タブ切り替え */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* チャット */
.chat-container {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.chat-message {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 14px;
    word-break: break-word;
}

.chat-message.mine {
    background: var(--primary);
    color: var(--white);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message.other {
    background: var(--white);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
    opacity: 0.8;
}

.chat-time {
    font-size: 10px;
    opacity: 0.6;
    text-align: right;
    margin-top: 2px;
}

.chat-input-area {
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
}

.char-count {
    font-size: 11px;
    color: var(--text-light);
    text-align: right;
    margin-top: 2px;
}

.char-count.over {
    color: var(--danger);
}

/* 全画面広告オーバーレイ */
.ad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-overlay-content {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    max-width: 90%;
    width: 360px;
    text-align: center;
}

.ad-overlay-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.ad-overlay-close {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ad-skip-btn {
    background: var(--text-light);
    color: var(--white);
    border: none;
    padding: 10px 32px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.ad-no-today {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
}

.ad-no-today input {
    cursor: pointer;
}

/* バナー広告 */
.ad-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 8px;
    text-align: center;
    z-index: 90;
}

.ad-banner-inner {
    max-width: 600px;
    margin: 0 auto;
    min-height: 50px;
    background: #f0f0f0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-light);
}

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

.modal {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    max-width: 90%;
    width: 340px;
    text-align: center;
}

.modal h3 {
    margin-bottom: 12px;
}

.modal p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ニックネーム入力 */
.nickname-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}

.nickname-section h3 {
    margin-bottom: 12px;
}

/* 空状態 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* フローティングアクションボタン */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(228, 0, 43, 0.4);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    background: var(--primary-dark);
}

/* シェア完了報告 */
.complete-section {
    background: #e8f5e9;
    border: 1px solid var(--success);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
    text-align: center;
}

/* レスポンシブ */
@media (max-width: 480px) {
    .header h1 {
        font-size: 17px;
    }
    .container {
        padding: 12px;
    }
}

/* アラートメッセージ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

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

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

/* ローディング */
.loading {
    text-align: center;
    padding: 20px;
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 画像プレビュー */
.image-preview {
    max-width: 100%;
    border-radius: var(--radius);
    margin-top: 8px;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    object-fit: cover;
}

/* フッターリンク */
.footer-links {
    text-align: center;
    padding: 20px 0;
    font-size: 13px;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    margin: 0 8px;
}

.footer-links a:hover {
    text-decoration: underline;
}
