/**
 * Character Counter Styles
 * 文字数カウンター専用スタイル
 *
 * Features:
 * - Mobile-first: Input on top, results below
 * - Desktop: 2-column layout (input | results)
 * - Counting options (checkboxes)
 *
 * Note: Stats grid styles are now in /public/css/components/stats-grid.css
 * Version: 2.3 - Mobile-first with input on top
 */

/* ========================================
   1. Layout - Mobile First (Input on Top)
   ======================================== */
.char-counter-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.char-counter-input-section {
    order: 1; /* Input on top on mobile */
}

.char-counter-results-section {
    order: 2; /* Results below input on mobile */
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 102, 204, 0.12);
    border: 2px solid #0066cc;
    margin-top: 8px;
}

.char-counter-results-section .results-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #0066cc;
    border-bottom: 2px solid rgba(0, 102, 204, 0.2);
    padding-bottom: 8px;
}

/* Compact 2-column stats-grid for mobile */
.char-counter-results-section .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

/* Smaller stat cards for mobile */
.char-counter-results-section .stat-card {
    padding: 10px 12px;
    background: #fff;
}

.char-counter-results-section .stat-value {
    font-size: 18px;
    margin: 6px 0;
}

.char-counter-results-section .stat-label {
    font-size: 11px;
}

/* Desktop: 2-column layout */
@media (min-width: 769px) {
    .char-counter-layout {
        flex-direction: row;
        gap: 24px;
        align-items: flex-start;
    }

    .char-counter-input-section {
        flex: 1;
        order: 1; /* Input on left */
        min-width: 0;
    }

    .char-counter-results-section {
        flex: 1;
        order: 2; /* Results on right */
        position: sticky;
        top: 80px;
        padding: 20px;
    }

    .char-counter-results-section .results-title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    /* Single column stats-grid for desktop */
    .char-counter-results-section .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .char-counter-results-section .stat-card {
        padding: 16px;
    }

    .char-counter-results-section .stat-value {
        font-size: 22px;
        margin: 10px 0;
    }

    .char-counter-results-section .stat-label {
        font-size: 13px;
    }
}

/* ========================================
   2. Counting Options
   ======================================== */
.counting-options {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    border: 2px solid #e5e7eb;
}

.counting-options h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.1em;
    color: #1f2937;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0066cc;
}

.checkbox-item label {
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #374151;
}

.checkbox-item input[type="checkbox"]:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* ========================================
   3. Responsive - Mobile Refinements
   ======================================== */
@media (max-width: 640px) {
    .counting-options {
        padding: 12px;
        margin: 12px 0;
    }

    .counting-options h3 {
        font-size: 0.95em;
    }

    .checkbox-group {
        gap: 10px;
    }

    .checkbox-item label {
        font-size: 13px;
    }

    /* Even more compact results on small screens */
    .char-counter-results-section {
        padding: 12px;
        top: 50px;
    }

    .char-counter-results-section .results-title {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .char-counter-results-section .stat-card {
        padding: 8px 10px;
    }

    .char-counter-results-section .stat-value {
        font-size: 16px;
        margin: 4px 0;
    }

    .char-counter-results-section .stat-label {
        font-size: 10px;
    }
}

/* ========================================
   4. Accessibility
   ======================================== */

/* Keyboard focus */
.checkbox-item input[type="checkbox"]:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .counting-options {
        border-width: 3px;
    }

    .checkbox-item input[type="checkbox"] {
        border: 2px solid #000;
    }
}

/* ========================================
   5. Print Styles
   ======================================== */
@media print {
    .counting-options {
        display: none;
    }
}
