/**
 * フロントエンド用スタイル
 */

.patent-invalidation-frontend,
.patent-simple-form,
.patent-history {
    max-width: 1200px;
    margin: 20px 0;
}

.patent-section {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.patent-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

.patent-form .form-group {
    margin-bottom: 20px;
}

.patent-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.patent-form input[type="text"],
.patent-form input[type="file"],
.patent-form select,
.patent-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    box-sizing: border-box;
}

/* 特許番号・引用文献番号入力フィールド専用スタイル */
.patent-form input[name="patent_number"],
.patent-form input[name="reference_numbers[]"] {
    min-width: 500px;
    max-width: 100%;
    font-family: monospace;
    font-size: 15px;
}

.patent-form input[type="checkbox"] {
    margin-right: 8px;
}

.patent-form textarea {
    resize: vertical;
}

.patent-form .button {
    background: #2271b1;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
}

.patent-form .button:hover {
    background: #135e96;
}

.patent-form .button-primary {
    background: #46b450;
    font-size: 18px;
    padding: 12px 30px;
}

.patent-form .button-primary:hover {
    background: #3a9b44;
}

/* 引用文献 */
.reference-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
}

.reference-item label {
    color: #666;
    font-size: 14px;
}

#add-reference {
    background: #666;
    color: white;
    font-size: 14px;
}

#add-reference:hover {
    background: #555;
}

/* 結果表示 */
#patent-result {
    background: #fff;
    border: 2px solid #46b450;
    border-radius: 5px;
    padding: 20px;
    margin-top: 30px;
}

#patent-result h3 {
    color: #46b450;
    margin-top: 0;
}

#result-content {
    margin: 20px 0;
    padding: 15px;
    background: #f0f8ff;
    border-left: 4px solid #2271b1;
    max-height: 400px;
    overflow-y: auto;
}

#download-link {
    background: #46b450;
    color: white;
    text-decoration: none;
    display: inline-block;
}

#download-link:hover {
    background: #3a9b44;
}

/* 履歴テーブル */
.patent-history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.patent-history-table th {
    background: #2271b1;
    color: white;
    padding: 10px;
    text-align: left;
}

.patent-history-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.patent-history-table tr:hover {
    background: #f5f5f5;
}

.patent-history-table .button-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* 通知 */
.patent-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
}

/* レスポンシブ */
@media (max-width: 600px) {
    .patent-invalidation-frontend,
    .patent-simple-form,
    .patent-history {
        padding: 10px;
    }
    
    .patent-section {
        padding: 15px;
    }
    
    .patent-history-table {
        font-size: 12px;
    }
    
    .patent-history-table th,
    .patent-history-table td {
        padding: 5px;
    }
}

/* ローディング */
.patent-loading {
    text-align: center;
    padding: 20px;
}

.patent-loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: patent-spin 1s linear infinite;
}

@keyframes patent-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ファイルドロップエリア */
.file-drop-area {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 5px;
    padding: 30px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-drop-area:hover {
    border-color: #2271b1;
    background: #f0f8ff;
}

.file-drop-area.dragover {
    border-color: #46b450;
    background: #e8f5e9;
    transform: scale(1.02);
}

.file-drop-area input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.file-drop-message {
    pointer-events: none;
    width: 100%;
}

.file-drop-message p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 14px;
}

.file-drop-icon {
    font-size: 48px;
    display: block;
    margin: 10px 0;
}

.file-name-display {
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 15px;
    width: 100%;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.file-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.file-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    word-break: break-all;
    overflow-wrap: break-word;
}

.file-size {
    color: #666;
    font-size: 12px;
}

.file-remove {
    background: #dc3232;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.file-remove:hover {
    background: #a00;
}

/* 引用文献のファイルドロップエリア */
.reference-file-drop-area {
    padding: 20px;
    min-height: 100px;
}

.reference-file-drop-area .file-drop-message p {
    font-size: 12px;
}

.reference-file-drop-area .file-drop-icon {
    font-size: 32px;
}

/* ドラッグ&ドロップ強化スタイル */
.file-drop-area.dragover {
    border-color: #46b450 !important;
    background: #e8f5e9 !important;
    transform: scale(1.02);
}

.file-drop-area * {
    pointer-events: none;
}

.file-drop-area input[type="file"] {
    pointer-events: auto;
}

.file-name-display .file-remove {
    pointer-events: auto;
}

/* テキストドロップ時のスタイル */
input[type="text"].text-drop-hover {
    background-color: #e3f2fd !important;
    border-color: #2196F3 !important;
}

/* ドロップフィードバック */
.drop-feedback {
    position: absolute;
    background-color: #4CAF50;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 9999;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    white-space: nowrap;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* ダウンロード完了画面 */
.download-ready {
    background: #e8f5e9;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
}

.download-ready h3 {
    color: #2e7d32;
    margin-bottom: 20px;
}

.download-ready .download-button {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.3s;
}

.download-ready .download-button:hover {
    background: #388E3C;
}

/* 処理状況表示 */
.processing-status {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.processing-status .status-step {
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
}

.processing-status .status-step:last-child {
    border-bottom: none;
}

.processing-status .status-step.completed {
    color: #4CAF50;
}

.processing-status .status-step.active {
    color: #2196F3;
    font-weight: bold;
}

.processing-status .status-step.pending {
    color: #999;
}