/* ==========================================================================
   テキストファイル突合ツール - スタイルシート
   ========================================================================== */

/* Base Styles
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
    line-height: 1.6;
}

/* Container
   ========================================================================== */

.container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Typography
   ========================================================================== */

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

h3 {
    color: #555;
    margin-bottom: 15px;
}

h4 {
    margin: 20px 0 10px 0;
}

/* Status Message
   ========================================================================== */

.status-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #c3e6cb;
}

.status-message small {
    opacity: 0.8;
}

/* File Upload Section
   ========================================================================== */

.upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.file-upload {
    border: 3px dashed #4285f4;
    padding: 25px;
    text-align: center;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.file-upload:hover {
    background: #e3f2fd;
    border-color: #1976d2;
    transform: translateY(-2px);
}

.file-upload h3 {
    color: #4285f4;
    margin-bottom: 15px;
}

/* Form Controls
   ========================================================================== */

.controls {
    display: flex;
    gap: 20px;
    margin: 25px 0;
    align-items: end;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

input[type="file"] {
    margin: 15px 0;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

input[type="file"]:hover {
    border-color: #4285f4;
}

select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

select:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

/* Buttons
   ========================================================================== */

button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

button:hover:before {
    left: 100%;
}

#compareBtn {
    background: linear-gradient(45deg, #4285f4, #1976d2);
    color: white;
}

#compareBtn:hover {
    background: linear-gradient(45deg, #1976d2, #1565c0);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

#compareBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#clearBtn {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
}

#clearBtn:hover {
    background: linear-gradient(45deg, #c82333, #bd2130);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* File Info
   ========================================================================== */

.file-info {
    margin-top: 15px;
    font-size: 12px;
    color: #666;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

/* Results Section
   ========================================================================== */

.results {
    margin-top: 30px;
}

/* Statistics
   ========================================================================== */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #4285f4;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabs
   ========================================================================== */

.tabs {
    display: flex;
    gap: 12px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 20px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    user-select: none;
}

.tab:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.tab.active {
    background: linear-gradient(45deg, #4285f4, #1976d2);
    color: white;
    border-color: #4285f4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

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

/* Tables
   ========================================================================== */

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: white;
    margin: 15px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: linear-gradient(45deg, #4285f4, #1976d2);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

tbody tr:hover {
    background: rgba(66, 133, 244, 0.05);
}

tbody tr:nth-child(even) {
    background: #f9f9f9;
}

/* Diff Highlighting
   ========================================================================== */

.diff-added {
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid #4caf50;
}

.diff-removed {
    background: rgba(244, 67, 54, 0.1);
    border-left: 4px solid #f44336;
}

.diff-changed {
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
}

/* Export Buttons
   ========================================================================== */

.export-buttons {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.export-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: linear-gradient(45deg, #218838, #1a9b7c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Utility Classes
   ========================================================================== */

.loading {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 16px;
}

.loading:after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #4285f4;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

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

/* Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .upload-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .tabs {
        flex-direction: column;
    }

    .export-buttons {
        flex-direction: column;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .stat-number {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .file-upload {
        padding: 15px;
    }

    button {
        padding: 10px 16px;
        font-size: 13px;
    }
}
