/**
 * Percentage Calculator - Mobile Optimized
 * パーセンテージ計算機 - スマホ最適化版
 *
 * Strategy:
 * - 共通コンポーネント (stats-grid.css) を活用
 * - 3つの計算機それぞれをモバイル最適化
 * - スマホで結果が常に見えるレイアウト
 * - 最小限の専用CSS
 *
 * Version: 1.0
 * Created: 2025-11-02
 */

/* ========================================
   1. Calculator Section Styling
   ======================================== */

.percentage-calc-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin-bottom: 24px;
}

.percentage-calc-input {
    order: 1; /* モバイル: 上 - 計算が先 */
    width: 100%;
}

.percentage-calc-results {
    order: 2; /* モバイル: 下 - 結果があと */
    width: 100%;
}

/* ========================================
   2. Input Row Styling
   ======================================== */

.percentage-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
    flex-wrap: wrap;
}

.percentage-input-row input {
    flex: 1;
    min-width: 80px;
    font-size: 18px;
    padding: 12px 8px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    text-align: center;
    box-sizing: border-box;
}

.percentage-input-row input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.percentage-input-row label {
    font-size: 14px;
    color: #374151;
    white-space: nowrap;
}

.percentage-input-row .percent-sign {
    font-size: 20px;
    font-weight: bold;
    color: #0066cc;
}

/* ========================================
   3. Button Styling
   ======================================== */

.percentage-calc-button {
    width: 100%;
    padding: 12px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 12px;
}

.percentage-calc-button:hover {
    background: #0052a3;
}

.percentage-calc-button:active {
    background: #003d7a;
}

/* ========================================
   4. Stats Grid for Results
   ======================================== */

.percentage-calc-results .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0;
}

.percentage-calc-results .stat-card {
    padding: 12px;
    background: #fff;
}

.percentage-calc-results .stat-value {
    font-size: 20px;
    margin: 6px 0;
    color: #0066cc;
    font-weight: 700;
}

.percentage-calc-results .stat-label {
    font-size: 11px;
}

/* ========================================
   5. Desktop Layout (769px+)
   ======================================== */

@media (min-width: 769px) {
    .percentage-calc-wrapper {
        flex-direction: row;
        gap: 24px;
        align-items: flex-start;
    }

    .percentage-calc-input {
        flex: 1;
        order: 1; /* PC: 左 */
        min-width: 0;
    }

    .percentage-calc-results {
        flex: 1;
        order: 2; /* PC: 右 */
        min-width: 0;
    }

    .percentage-calc-results .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }

    .percentage-calc-results .stat-card {
        padding: 16px;
    }

    .percentage-calc-results .stat-value {
        font-size: 24px;
        margin: 10px 0;
    }

    .percentage-calc-results .stat-label {
        font-size: 13px;
    }

    .percentage-input-row {
        flex-wrap: nowrap;
    }

    .percentage-input-row input {
        min-width: 100px;
    }
}

/* ========================================
   6. Small Mobile (640px-)
   ======================================== */

@media (max-width: 640px) {
    .percentage-input-row {
        gap: 6px;
    }

    .percentage-input-row input {
        font-size: 16px;
        padding: 10px;
        min-width: 70px;
    }

    .percentage-input-row label {
        font-size: 13px;
    }

    .percentage-calc-button {
        padding: 10px;
        font-size: 15px;
    }

    .percentage-calc-results .stat-card {
        padding: 10px;
    }

    .percentage-calc-results .stat-value {
        font-size: 18px;
    }

    .percentage-calc-results .stat-label {
        font-size: 10px;
    }
}

/* ========================================
   7. Calculator Section Spacing
   ======================================== */

.calculator-section-title {
    font-size: 1.2em;
    color: #0066cc;
    margin: 0 0 16px 0;
    font-weight: 600;
}

/* スマホで各計算機を区切る */
.percentage-calc-wrapper + .percentage-calc-wrapper {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid #e5e7eb;
}

@media (max-width: 640px) {
    .percentage-calc-wrapper + .percentage-calc-wrapper {
        margin-top: 24px;
        padding-top: 24px;
    }
}
