/**
 * DVTV 書類プロセッサー フロントエンドCSS
 */

.dvtv-sp-form-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.dvtv-sp-form-wrap h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
    color: #0073aa;
}

.dvtv-sp-form-wrap h4 {
    color: #333;
    margin-bottom: 15px;
}

/* 解析セクション */
.dvtv-sp-ocr-section {
    background: #e8f4fc;
    border: 2px solid #0073aa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.dvtv-sp-ocr-section h4 {
    margin-top: 0;
    color: #0066cc;
}

/* ドロップゾーン */
.dvtv-sp-dropzone {
    border: 3px dashed #0073aa;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.dvtv-sp-dropzone:hover {
    background: #f0f8ff;
    border-color: #005177;
}

.dvtv-sp-dropzone-active {
    background: #e0f0ff !important;
    border-color: #005177 !important;
    border-style: solid !important;
}

.dvtv-sp-dropzone p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.8;
}

.dvtv-sp-dropzone input[type="file"] {
    display: none;
}

/* ファイルリスト */
.dvtv-sp-file-list {
    margin-bottom: 15px;
}

.dvtv-sp-file-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dvtv-sp-file-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 5px;
}

.dvtv-sp-remove-file {
    margin-left: auto;
    background: none;
    border: none;
    color: #d44b4b;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
}

.dvtv-sp-remove-file:hover {
    color: #a00;
}

/* 解析実行ボタン */
.dvtv-sp-ocr-btn-wrap {
    text-align: center;
    margin: 20px 0;
}

#dvtv-sp-ocr-btn {
    display: inline-block;
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0073aa, #005a87);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.4);
    letter-spacing: 2px;
}

#dvtv-sp-ocr-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87, #004066);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.6);
    transform: translateY(-2px);
}

#dvtv-sp-ocr-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 115, 170, 0.4);
}

#dvtv-sp-ocr-btn:disabled {
    background: #999;
    color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

#dvtv-sp-ocr-status {
    margin-top: 15px;
}

/* フォームセクション */
#dvtv-sp-form-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

/* フォーム */
.dvtv-sp-form {
    margin-top: 15px;
}

.dvtv-sp-field {
    margin-bottom: 20px;
}

.dvtv-sp-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.dvtv-sp-field .required {
    color: #d63638;
}

.dvtv-sp-field input[type="text"],
.dvtv-sp-field input[type="number"],
.dvtv-sp-field input[type="date"],
.dvtv-sp-field select,
.dvtv-sp-field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.dvtv-sp-field input:focus,
.dvtv-sp-field select:focus,
.dvtv-sp-field textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

/* ラジオボタングループ */
.dvtv-sp-radio-group {
    display: flex;
    gap: 20px;
    padding: 10px 0;
}

.dvtv-sp-radio-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dvtv-sp-radio-label:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.dvtv-sp-radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

.dvtv-sp-radio-label input[type="radio"]:checked + span {
    color: #0073aa;
    font-weight: 600;
}

.dvtv-sp-radio-label:has(input[type="radio"]:checked) {
    border-color: #0073aa;
    background: #e8f4fc;
}

.dvtv-sp-field-hint {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* ラジオボタンのOCR入力スタイル */
.dvtv-sp-radio-group.dvtv-sp-ocr-filled .dvtv-sp-radio-label:has(input[type="radio"]:checked) {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

/* 解析で入力されたフィールド - 青ネオン枠 */
.dvtv-sp-ocr-filled {
    border: 2px solid #00bfff !important;
    box-shadow: 0 0 8px #00bfff, 0 0 12px #00bfff !important;
    background-color: #f0faff !important;
}

/* 2カラム */
.dvtv-sp-row {
    display: flex;
    gap: 20px;
}

.dvtv-sp-row .dvtv-sp-field {
    flex: 1;
}

/* アクションボタン */
.dvtv-sp-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.dvtv-sp-actions .button {
    padding: 10px 30px;
    font-size: 14px;
}

/* 登録ボタン */
#dvtv-sp-submit-btn {
    background: linear-gradient(135deg, #0073aa, #005a87) !important;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    padding: 15px 50px !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

#dvtv-sp-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87, #004066) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

#dvtv-sp-submit-btn:disabled {
    background: #999 !important;
    color: #ccc !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* 提出先設定の保存ボタン */
#dvtv-sp-save-users-btn {
    background: linear-gradient(135deg, #0073aa, #005a87) !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    padding: 12px 40px !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

#dvtv-sp-save-users-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87, #004066) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

#dvtv-sp-save-users-btn:disabled {
    background: #999 !important;
    color: #ccc !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* 重複チェック結果 */
.dvtv-sp-duplicate-result {
    margin-top: 20px;
}

.dvtv-sp-duplicate-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    color: #856404;
}

.dvtv-sp-duplicate-warning strong {
    font-size: 16px;
}

.dvtv-sp-duplicate-warning ul {
    margin: 10px 0;
    padding-left: 20px;
}

.dvtv-sp-duplicate-warning li {
    margin-bottom: 8px;
}

.dvtv-sp-duplicate-warning a {
    color: #0066cc;
}

.dvtv-sp-duplicate-ok {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    color: #155724;
}

/* メッセージ */
.dvtv-sp-message {
    margin-top: 20px;
}

.dvtv-sp-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    color: #155724;
}

.dvtv-sp-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px;
    color: #721c24;
}

.dvtv-sp-info {
    background: #e8f4fc;
    border: 1px solid #0073aa;
    border-radius: 8px;
    padding: 15px;
    color: #0073aa;
}

/* 提出先ユーザー設定ページ */
.dvtv-sp-submit-users-wrap {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.dvtv-sp-submit-users-wrap h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
    color: #0073aa;
}

.dvtv-sp-users-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
    background: #fff;
}

.dvtv-sp-user-item {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.dvtv-sp-user-item:last-child {
    border-bottom: none;
}

.dvtv-sp-user-item:hover {
    background: #f5f5f5;
}

.dvtv-sp-user-item input[type="checkbox"] {
    margin-right: 10px;
}

/* ========================================
   詳細表示スタイル
======================================== */

.dvtv-sp-detail-wrap {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.dvtv-sp-detail-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dvtv-sp-detail-table th,
.dvtv-sp-detail-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.dvtv-sp-detail-table th {
    background: #f5f5f5;
    width: 150px;
    font-weight: 600;
    color: #333;
}

.dvtv-sp-detail-table td {
    color: #555;
}

.dvtv-sp-detail-table tr:last-child th,
.dvtv-sp-detail-table tr:last-child td {
    border-bottom: none;
}

.dvtv-sp-detail-files {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.dvtv-sp-detail-files h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
}

.dvtv-sp-detail-files ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dvtv-sp-detail-files li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 5px;
}

.dvtv-sp-file-link {
    flex: 1;
    color: #0073aa;
    text-decoration: none;
}

.dvtv-sp-file-link:hover {
    text-decoration: underline;
}

.dvtv-sp-download-btn {
    padding: 5px 10px;
    background: #0073aa;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
}

.dvtv-sp-download-btn:hover {
    background: #005177;
}

/* レスポンシブ */
@media (max-width: 600px) {
    .dvtv-sp-row {
        flex-direction: column;
        gap: 0;
    }
    
    .dvtv-sp-actions {
        flex-direction: column;
    }
    
    .dvtv-sp-actions .button {
        width: 100%;
    }
    
    .dvtv-sp-detail-thumbnail img {
        max-width: 100%;
    }
    
    .dvtv-sp-detail-table th {
        width: 100px;
    }
    
    .dvtv-sp-history-table {
        font-size: 12px;
    }
    
    .dvtv-sp-history-table th,
    .dvtv-sp-history-table td {
        padding: 6px 4px;
    }
}

/* ========================================
   編集機能スタイル
======================================== */

.dvtv-sp-edit-actions {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #e8f4fc 0%, #f0f8ff 100%);
    border-radius: 12px;
    text-align: right;
    border: 1px solid #cce5ff;
}

/* リッチな編集ボタン */
.dvtv-sp-edit-btn-rich {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #fff !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    transition: all 0.3s ease;
}

.dvtv-sp-edit-btn-rich:hover {
    background: linear-gradient(135deg, #005177 0%, #003d5c 100%);
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4);
}

.dvtv-sp-edit-icon {
    font-size: 18px;
}

/* テーマのアイキャッチをクリック可能に */
.dvtv-sp-clickable-thumbnail {
    display: inline-block;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dvtv-sp-clickable-thumbnail:hover {
    opacity: 0.9;
}

.dvtv-sp-clickable-thumbnail::after {
    content: '🔍 クリックで原本を表示';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 115, 170, 0.9);
    color: #fff;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.dvtv-sp-clickable-thumbnail:hover::after {
    opacity: 1;
}

/* サムネイルオーバーレイ（プラグイン独自表示用） */
.dvtv-sp-detail-thumbnail {
    text-align: center;
    margin-bottom: 20px;
}

.dvtv-sp-detail-thumbnail a {
    display: inline-block;
    position: relative;
    border: 3px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.dvtv-sp-detail-thumbnail a:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.dvtv-sp-detail-thumbnail img {
    max-width: 400px;
    height: auto;
    display: block;
}

.dvtv-sp-thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 115, 170, 0.9);
    color: #fff;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dvtv-sp-detail-thumbnail a:hover .dvtv-sp-thumb-overlay {
    opacity: 1;
}

.dvtv-sp-edit-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.dvtv-sp-edit-wrap h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
    color: #0073aa;
}

/* ========================================
   編集履歴スタイル
======================================== */

.dvtv-sp-history-wrap {
    margin-top: 40px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.dvtv-sp-history-wrap h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.dvtv-sp-history-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
}

.dvtv-sp-history-table th,
.dvtv-sp-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.dvtv-sp-history-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.dvtv-sp-history-table tbody tr:hover {
    background: #f9f9f9;
}

.dvtv-sp-history-old {
    color: #999;
    text-decoration: line-through;
}

.dvtv-sp-history-new {
    color: #28a745;
    font-weight: 500;
}

/* ========================================
   オーバーレイローディング（波形ネオン風 + マトリックスレイン）
======================================== */

.dvtv-sp-loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #000000 !important;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999 !important;
}

/* 完全な黒背景レイヤー */
.dvtv-sp-loading-bg {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #000000 !important;
    z-index: 1 !important;
}

/* マトリックスレイン Canvas */
.dvtv-sp-matrix-canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2 !important;
}

/* コンテンツを前面に */
.dvtv-sp-loading-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent !important;
}

/* 波形ローダー */
.dvtv-sp-wave-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 60px;
}

.dvtv-sp-wave-loader span {
    width: 6px;
    height: 20px;
    background: linear-gradient(180deg, #00d4ff, #0099ff, #0066ff);
    border-radius: 3px;
    animation: dvtv-wave 1.2s ease-in-out infinite;
    box-shadow: 
        0 0 10px #00d4ff,
        0 0 20px #00d4ff,
        0 0 30px #0099ff,
        0 0 40px #0066ff;
}

.dvtv-sp-wave-loader span:nth-child(1) { animation-delay: 0s; }
.dvtv-sp-wave-loader span:nth-child(2) { animation-delay: 0.1s; }
.dvtv-sp-wave-loader span:nth-child(3) { animation-delay: 0.2s; }
.dvtv-sp-wave-loader span:nth-child(4) { animation-delay: 0.3s; }
.dvtv-sp-wave-loader span:nth-child(5) { animation-delay: 0.4s; }
.dvtv-sp-wave-loader span:nth-child(6) { animation-delay: 0.5s; }
.dvtv-sp-wave-loader span:nth-child(7) { animation-delay: 0.6s; }

@keyframes dvtv-wave {
    0%, 100% {
        height: 20px;
        opacity: 0.6;
    }
    50% {
        height: 50px;
        opacity: 1;
    }
}

.dvtv-sp-loading-text {
    color: #00d4ff;
    font-size: 20px;
    margin-top: 30px;
    font-weight: 600;
    text-shadow: 
        0 0 10px #00d4ff,
        0 0 20px #00d4ff,
        0 0 30px #0099ff;
    letter-spacing: 2px;
}

.dvtv-sp-loading-subtext {
    color: rgba(0, 212, 255, 0.7);
    font-size: 14px;
    margin-top: 10px;
    text-shadow: 0 0 10px #00d4ff;
}

.dvtv-sp-loading-progress {
    width: 200px;
    height: 3px;
    background: rgba(0, 212, 255, 0.2);
    border-radius: 2px;
    margin-top: 25px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.dvtv-sp-loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #0099ff, #00d4ff);
    border-radius: 2px;
    animation: dvtv-progress 2s ease-in-out infinite;
    box-shadow: 0 0 15px #00d4ff;
}

@keyframes dvtv-progress {
    0% { width: 0%; margin-left: 0; }
    50% { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}
