/**
 * Unified Real-time Calculator Styles - Enhanced for Mobile & Desktop
 * 全リアルタイム計算機共通のスタイル定義（モバイル・PC最適化版）
 *
 * 適用対象:
 * - RealTimeAdditionCalculator
 * - RealTimeSubtractionCalculator
 * - RealTimeMultiplicationCalculator
 * - RealTimeDivisionCalculator
 * - RealTimeModuloCalculator
 */

/* ========================================
   1. Calculator Container
   ======================================== */
.realtime-calc-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
}

/* ========================================
   2. Calculator Display Area - Enhanced
   ======================================== */
.realtime-calc-display {
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    padding: 40px 32px;
    border-radius: 16px;
    border: 2px solid #e0e4ea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ========================================
   3. Input Row Layout - Mobile First
   ======================================== */
.realtime-calc-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 16px;
    margin-bottom: 28px;
    flex-direction: column;
}

/* Desktop: 横並びレイアウト */
@media (min-width: 640px) {
    .realtime-calc-row {
        flex-direction: row;
        align-items: center;
        gap: 24px;
    }
}

/* ========================================
   4. Input Fields - Enhanced Touch Targets
   ======================================== */
.realtime-calc-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 100%;
}

@media (min-width: 640px) {
    .realtime-calc-input-group {
        flex: 1 1 auto;
        min-width: 180px;
        max-width: 240px;
    }
}

.realtime-calc-input-group label {
    font-size: 15px;
    font-weight: 600;
    color: #4a5568;
    text-align: left;
    margin-bottom: 2px;
}

@media (min-width: 640px) {
    .realtime-calc-input-group label {
        text-align: center;
    }
}

.realtime-calc-input {
    width: 100%;
    padding: 18px 16px;
    font-size: 22px;
    font-weight: 500;
    text-align: center;
    border: 3px solid #cbd5e0;
    border-radius: 12px;
    background: white;
    transition: all 0.25s ease;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    /* モバイル: 最小44px高さ（Apple推奨タッチターゲット） */
    min-height: 60px;
}

.realtime-calc-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15), 0 4px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.realtime-calc-input::-webkit-inner-spin-button,
.realtime-calc-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* プレースホルダーのスタイル */
.realtime-calc-input::placeholder {
    color: #a0aec0;
    opacity: 0.7;
}

/* ========================================
   5. Operator Symbol - Enhanced
   ======================================== */
.realtime-calc-operator {
    font-size: 32px;
    font-weight: bold;
    color: #0066cc;
    line-height: 1;
    user-select: none;
    text-align: center;
    flex-shrink: 0;
    padding: 16px 0;
    /* モバイル: 等号のように見せる */
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 640px) {
    .realtime-calc-operator {
        font-size: 42px;
        padding: 0;
        min-width: 50px;
    }
}

/* ========================================
   6. Result Display - Enhanced (青基調)
   ======================================== */
.realtime-calc-result {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    border: none;
    border-radius: 16px;
    padding: 28px 24px;
    margin-top: 32px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.25);
}

.realtime-calc-result-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.realtime-calc-result-value {
    font-size: 42px;
    font-weight: 700;
    color: white;
    word-break: break-all;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

@media (min-width: 640px) {
    .realtime-calc-result-value {
        font-size: 52px;
    }
}

/* Division/Modulo専用: 詳細結果表示 - Enhanced */
.realtime-calc-detailed-result {
    display: grid;
    gap: 14px;
    margin-top: 32px;
}

.realtime-calc-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.realtime-calc-result-row:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.realtime-calc-result-row-label {
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
}

.realtime-calc-result-row-value {
    font-size: 24px;
    font-weight: 700;
    color: #0066cc;
}

/* ========================================
   7. Clear/Reset Button - Enhanced
   ======================================== */
.realtime-calc-btn-clear {
    width: 100%;
    margin: 28px auto 0;
    padding: 16px 32px;
    font-size: 17px;
    font-weight: 600;
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(74, 85, 104, 0.25);
    /* モバイル: 最小44px高さ */
    min-height: 54px;
}

.realtime-calc-btn-clear:hover {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 6px 16px rgba(74, 85, 104, 0.35);
    transform: translateY(-2px);
}

.realtime-calc-btn-clear:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(74, 85, 104, 0.25);
}

@media (min-width: 640px) {
    .realtime-calc-btn-clear {
        max-width: 280px;
        font-size: 16px;
    }
}

/* ========================================
   8. Error Message - Enhanced
   ======================================== */
.realtime-calc-error {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    color: white;
    padding: 18px 20px;
    border-radius: 12px;
    border: none;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    margin-top: 20px;
    display: none;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.25);
}

.realtime-calc-error.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

/* ========================================
   9. Responsive Design - Enhanced
   ======================================== */

/* Small Mobile (360px以下) */
@media (max-width: 360px) {
    .realtime-calc-display {
        padding: 28px 20px;
    }

    .realtime-calc-input {
        font-size: 20px;
        padding: 16px 14px;
    }

    .realtime-calc-operator {
        font-size: 28px;
    }

    .realtime-calc-result-value {
        font-size: 36px;
    }
}

/* Tablet (768px以上) */
@media (min-width: 768px) {
    .realtime-calc-display {
        padding: 48px 40px;
    }

    .realtime-calc-input {
        min-height: 64px;
    }
}

/* Desktop (1024px以上) */
@media (min-width: 1024px) {
    .realtime-calc-container {
        max-width: 900px;
    }

    .realtime-calc-result {
        padding: 32px 28px;
    }
}

/* ========================================
   10. Accessibility Enhancements
   ======================================== */

/* キーボードフォーカス時の視覚的フィードバック強化 */
.realtime-calc-input:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

.realtime-calc-btn-clear:focus-visible {
    outline: 3px solid #718096;
    outline-offset: 2px;
}

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
    .realtime-calc-input {
        border-width: 4px;
    }

    .realtime-calc-result {
        border: 3px solid #0066cc;
    }
}

/* ========================================
   11. Print Styles
   ======================================== */
@media print {
    .realtime-calc-btn-clear {
        display: none;
    }

    .realtime-calc-display {
        box-shadow: none;
        border: 1px solid #000;
    }

    .realtime-calc-result {
        background: white;
        border: 2px solid #000;
        color: #000;
    }

    .realtime-calc-result-value {
        color: #000;
        text-shadow: none;
    }
}
