/* responsive.css - レスポンシブ対応のメディアクエリ */

/* タブレット対応 (1024px以下) */
@media screen and (max-width: 1024px) {
    .edit-row .button-container {
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }

    .edit-row .button-container .btn {
        width: auto;
        margin: 0;
        min-width: 70px;
    }

    .action-column.expanded {
        width: 90px;
    }

    .date-column { 
        width: 70px;
        min-width: 70px;
    }

    .page-column { 
        width: 90px; 
    }
}

/* スマホ対応 (640px以下) */
@media screen and (max-width: 640px) {
    .initial-actions {
        flex-direction: row;
        gap: 10px;
        margin: 0 10px;
    }

    .btn-create,
    .file-input-button {
        width: 100%;
        max-width: none;
        flex: 1;
        height: auto;
        min-height: 36px;
        margin: 0;
        padding: 8px 12px;
        font-size: 13px;
    }

    /* ファイル操作セクション */
    .file-operations-section {
        padding: 15px !important;
    }

    .file-operations-section h2 {
        font-size: 16px !important;
    }

    .file-actions {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .file-actions .btn,
    .file-actions .file-input-button {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* アクションボタンエリア */
    .action-buttons {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0 10px !important;
    }

    .action-buttons .btn {
        width: 100% !important;
        max-width: 100% !important;
        margin: 5px 0 !important;
    }

    .date-column {
        width: 60px;
        min-width: 60px;
        padding: 4px 2px;
        line-height: 1.2;
    }
    
    .date-desktop {
        display: none;
    }

    .date-mobile {
        display: flex;
        flex-direction: column;
        gap: 0;
        line-height: 1;
    }

    .date-year {
        margin-bottom: 0;
    }

    .date-md {
        margin-top: 0;
    }

    .page-column { 
        width: 60px; 
    }

    .page-range-long {
        display: none;
    }
    
    .page-range-short {
        display: inline;
    }

    .action-column {
        width: 80px;
    }

    .action-column.expanded {
        width: 80px;
    }

    .edit-row .button-container {
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }

    .edit-row .button-container .btn {
        width: auto;
        min-width: 60px;
        padding: 6px 8px;
        font-size: 13px;
        margin: 0;
    }
    
    .record-row {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    /* ヘッダーのレスポンシブ対応 */
    header {
        padding: 10px 0 !important;
    }
    
    header > div {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: stretch !important;
    }
    
    /* ロゴ部分 */
    header > div > div:first-child {
        justify-content: center !important;
    }
    
    header > div > div:first-child a {
        font-size: 20px !important;
    }
    
    /* ボタンエリア */
    header > div > div:last-child {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    
    /* デバイス管理ボタン */
    #deviceManagementButton {
        padding: 8px 12px !important;
        font-size: 13px !important;
        flex: 1 1 auto !important;
        min-width: 120px !important;
    }
    
    /* ログアウトボタン */
    #logoutButton {
        padding: 8px 12px !important;
        font-size: 13px !important;
        flex: 1 1 auto !important;
        min-width: 100px !important;
    }
    
    /* 言語 */
    #languageSelect {
        padding: 8px 12px !important;
        font-size: 13px !important;
        flex: 1 1 auto !important;
        min-width: 100px !important;
    }

    /* 書籍ヘッダーのレスポンシブ対応 */
    .book-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .book-header h2 {
        max-width: 100% !important;
        margin-bottom: 10px !important;
    }

    .book-header-buttons {
        width: 100%;
        justify-content: flex-start !important;
    }

    .book-info-buttons {
        flex-wrap: wrap;
    }

    /* 書籍情報部分の余白調整 */
    .book {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .book p {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* bodyの余白調整 */
    body {
        margin-left: 15px !important;
        margin-right: 15px !important;
    }

    /* 書籍情報のフォントサイズ調整 - より具体的に */
    .book .book-header h2 {
        font-size: 0.9em !important;
        line-height: 1.3 !important;
    }

    .book > p {
        font-size: 0.9em !important;
    }

    .book .book-links,
    .book .book-author-links,
    .book .book-similar-links {
        font-size: 0.9em !important;
    }

    /* すべての検索リンクのフォントサイズを統一 - より具体的に */
    .book .book-links a,
    .book .book-author-links a,
    .book .book-similar-links a,
    .book .book-links .btn-link,
    .book .book-author-links .btn-link,
    .book .book-similar-links .btn-link {
        font-size: 0.9em !important;
    }

    /* 著者情報のフォントサイズ */
    .book > p strong {
        font-size: 1em !important;
    }
}

/* 非常に小さな画面 (480px以下) */
@media screen and (max-width: 480px) {
    .initial-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-create,
    .file-input-button {
        flex: none;
    }

    /* ヘッダーのさらなる最適化 */
    header > div > div:first-child a {
        font-size: 18px !important;
    }
    
    header > div > div:first-child a i {
        margin-right: 6px !important;
    }
    
    #deviceManagementButton,
    #logoutButton,
    #languageSelect {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }

    /* さらに小さい画面での余白調整 */
    body {
        margin-left: 10px !important;
        margin-right: 10px !important;
    }

    .book {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* さらに小さい画面でのフォントサイズ調整 */
    .book .book-header h2 {
        font-size: 0.85em !important;
    }

    .book > p {
        font-size: 0.85em !important;
    }

    .book .book-links,
    .book .book-author-links,
    .book .book-similar-links {
        font-size: 0.85em !important;
    }

    .book .book-links a,
    .book .book-author-links a,
    .book .book-similar-links a,
    .book .book-links .btn-link,
    .book .book-author-links .btn-link,
    .book .book-similar-links .btn-link {
        font-size: 0.85em !important;
    }

    .book > p strong {
        font-size: 1em !important;
    }
}

/* ランディングページのレスポンシブ対応 */
@media (max-width: 968px) {
    .hero h1 {
        font-size: 32px;
    }
    
    .hero p {
        font-size: 16px;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .pricing-options {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 28px;
    }
    
    .index-page .mobile-menu-btn {
        display: block;
    }
    
    .index-page .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        text-align: center;
        margin-top: 15px;
    }
    
    .index-page .nav-links.active {
        display: flex;
    }
    
    .index-page .logo {
        font-size: 20px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .index-page .btn-primary,
    .index-page .btn-secondary,
    .btn-outline {
        width: 100%;
    }
    
    .pricing-options {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .pricing-card {
        max-width: 100%;
    }
    
    .feature-card h3 {
        font-size: 20px;
    }
    
    .price {
        font-size: 30px;
    }
    
    .popular-tag {
        font-size: 12px;
        padding: 4px 12px;
    }
    
    .discount-tag {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero h1 {
        font-size: 24px;
    }
    
    .hero p {
        font-size: 15px;
    }
    
    .section-title {
        font-size: 24px;
    }
    
    .feature-icon {
        font-size: 30px;
    }
    
    .feature-card {
        padding: 20px;
    }
    
    .testimonial-content::before,
    .testimonial-content::after {
        font-size: 30px;
    }
    
    .testimonial-author img {
        width: 40px;
        height: 40px;
    }
    
    .pricing-card {
        padding: 25px 15px;
    }
    
    .pricing-options {
        grid-template-columns: 1fr;
    }
    
    .cta h2 {
        font-size: 24px;
    }
    
    .cta p {
        font-size: 15px;
    }
    
    .free-trial-badge {
        font-size: 14px;
        padding: 8px 16px;
    }
}

/* ========================================
   モーダル・ダイアログのレスポンシブ対応
   ======================================== */

/* タブレット・スマホ共通 (768px以下) */
@media screen and (max-width: 768px) {
    /* 保存ダイアログ */
    .save-dialog {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px !important;
    }

    .save-dialog h3 {
        font-size: 18px !important;
    }

    .save-dialog-input-row {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .save-dialog-input-row select {
        min-width: 100% !important;
    }

    /* 検索・置換モーダル */
    #findModal,
    #findReplaceModal {
        width: 95% !important;
        max-width: 95% !important;
        top: 60px !important;
        right: 10px !important;
        left: 10px !important;
        margin: 0 auto !important;
    }

    #findModal h3,
    #findReplaceModal h3 {
        font-size: 15px !important;
    }

    #findModal input,
    #findReplaceModal input {
        font-size: 14px !important;
        padding: 8px !important;
    }

    #findModal .btn,
    #findReplaceModal .btn {
        font-size: 13px !important;
        padding: 8px 14px !important;
    }

    /* 記録編集モーダル */
    #editRecordModal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px !important;
    }

    #editRecordModal h3 {
        font-size: 16px !important;
    }

    #editRecordModal input,
    #editRecordModal textarea {
        font-size: 14px !important;
    }

    /* 削除確認モーダル */
    #deleteModal .modal-content,
    #deleteBookModal .modal-content {
        width: 90% !important;
        max-width: 400px !important;
        padding: 20px !important;
    }

    #deleteModal p,
    #deleteBookModal p {
        font-size: 14px !important;
    }

    /* モーダルボタン */
    .modal-buttons {
        flex-wrap: wrap !important;
    }

    .modal-buttons .btn {
        min-width: 100px !important;
        font-size: 14px !important;
        padding: 10px 16px !important;
    }

    /* 年齢確認モーダル */
    #ageVerificationModal .modal-content {
        width: 95% !important;
        max-width: 420px !important;
        padding: 20px !important;
    }

    #ageVerificationModal h3 {
        font-size: 18px !important;
    }

    #ageVerificationModal p,
    #ageVerificationModal li {
        font-size: 14px !important;
    }
}

/* スマホ対応 (480px以下) */
@media screen and (max-width: 480px) {
    /* 保存ダイアログ */
    .save-dialog {
        padding: 15px !important;
    }

    .save-dialog h3 {
        font-size: 16px !important;
        margin-bottom: 15px !important;
    }

    .save-dialog-input-group {
        margin-bottom: 15px !important;
    }

    .save-dialog-input-group label {
        font-size: 13px !important;
    }

    .save-dialog-input-row input,
    .save-dialog-input-row select {
        font-size: 13px !important;
        padding: 8px 10px !important;
    }

    /* 検索・置換モーダル */
    #findModal,
    #findReplaceModal {
        width: calc(100% - 20px) !important;
        top: 50px !important;
        right: 10px !important;
        left: 10px !important;
    }

    #findModal h3,
    #findReplaceModal h3 {
        font-size: 14px !important;
    }

    #findModal input,
    #findReplaceModal input {
        font-size: 13px !important;
        padding: 6px !important;
    }

    #findModal .btn,
    #findReplaceModal .btn {
        font-size: 12px !important;
        padding: 6px 10px !important;
        min-width: 70px !important;
    }

    .modal-buttons {
        gap: 8px !important;
    }

    /* 記録編集モーダル */
    #editRecordModal .modal-content {
        padding: 15px !important;
    }

    #editRecordModal h3 {
        font-size: 15px !important;
        margin-bottom: 15px !important;
    }

    #editRecordModal input,
    #editRecordModal textarea {
        font-size: 13px !important;
        padding: 8px !important;
    }

    #editRecordModal textarea {
        min-height: 120px !important;
    }

    #editRecordModal .btn {
        font-size: 13px !important;
        padding: 10px 16px !important;
    }

    /* 削除確認モーダル */
    #deleteModal .modal-content,
    #deleteBookModal .modal-content {
        width: calc(100% - 40px) !important;
        padding: 15px !important;
    }

    #deleteModal p,
    #deleteBookModal p {
        font-size: 13px !important;
    }

    .modal-buttons .btn {
        min-width: 80px !important;
        font-size: 13px !important;
        padding: 8px 12px !important;
    }

    /* 年齢確認モーダル */
    #ageVerificationModal .modal-content {
        width: calc(100% - 30px) !important;
        padding: 15px !important;
    }

    #ageVerificationModal h3 {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }

    #ageVerificationModal p,
    #ageVerificationModal li {
        font-size: 13px !important;
    }

    #ageVerificationModal .highlight-box {
        padding: 12px !important;
    }

    #ageVerificationModal .btn {
        font-size: 13px !important;
        padding: 10px 16px !important;
    }
}