/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ヘッダー */
header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* カード */
.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.5s ease-out;
}

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

h2 {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: #667eea;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

h2 i {
    margin-right: 10px;
}

/* フォームグループ */
.form-group-title {
    margin-top: 30px;
    margin-bottom: 15px;
}

.form-group-title h3 {
    font-size: 1.2em;
    color: #555;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.form-group-title h3 i {
    margin-right: 8px;
    color: #667eea;
}

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

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 1.05em;
}

.form-group label i {
    margin-right: 8px;
    color: #667eea;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* アップロードエリア */
.upload-area {
    border: 3px dashed #ccc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f9f9f9;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.drag-over {
    border-color: #667eea;
    background: #e8edff;
    transform: scale(1.02);
}

.upload-area i {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 15px;
}

.upload-area p {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 15px;
}

/* ボタン */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-success:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-large {
    padding: 18px 50px;
    font-size: 1.2em;
}

.file-label {
    display: inline-block;
}

/* ファイル情報 */
.file-info {
    margin-top: 20px;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 8px;
    display: none;
}

.file-info.show {
    display: block;
}

.file-info i {
    color: #28a745;
    margin-right: 10px;
}

/* CSV フォーマット情報 */
.csv-format-info {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.csv-format-info h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: #667eea;
}

.csv-format-info pre {
    background: #fff;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 0.95em;
    border: 1px solid #e0e0e0;
}

.csv-format-info .note {
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
}

/* アクションセクション */
.action-section {
    text-align: center;
    margin: 30px 0;
}

/* 給与明細書スタイル */
.payslip-header {
    text-align: center;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.payslip-header h2 {
    border: none;
    margin-bottom: 15px;
}

.company-info {
    margin: 15px 0;
    font-size: 0.95em;
    color: #555;
}

.company-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.company-address {
    font-size: 0.9em;
}

.employee-info {
    margin-top: 15px;
    font-size: 1.1em;
}

.employee-name {
    font-weight: 600;
}

/* 勤務詳細セクション */
.work-details-section {
    margin-bottom: 20px;
}

.work-details-section h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #555;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

/* 詳細テーブル */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.detail-table thead {
    background: #667eea;
    color: white;
}

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

.detail-table th {
    font-weight: 600;
    font-size: 0.9em;
}

.detail-table tbody tr:hover {
    background: #f8f9fa;
}

.detail-table tbody tr:last-child td {
    border-bottom: none;
}

.detail-table tfoot .total-row {
    background: #f8f9fa;
    font-weight: 600;
    border-top: 2px solid #667eea;
}

.detail-table tfoot .total-label {
    text-align: right;
    color: #555;
}

.detail-table tfoot .total-value {
    color: #667eea;
    font-size: 1.1em;
}

/* 給与明細テーブル */
.payslip-tables {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.payslip-section h3 {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
}

.payslip-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.payslip-table tr {
    border-bottom: 1px solid #e0e0e0;
}

.payslip-table tr:last-child {
    border-bottom: none;
}

.payslip-table td {
    padding: 8px 12px;
    font-size: 0.95em;
}

.payslip-table .item-label {
    font-weight: 600;
    color: #555;
    width: 50%;
    background: #f8f9fa;
}

.payslip-table .item-value {
    text-align: right;
    font-weight: 500;
}

.payslip-table .note-text {
    font-size: 0.85em;
    color: #666;
    font-weight: normal;
}

.payslip-table .subtotal-row {
    background: #f0f4ff;
    border-top: 2px solid #667eea;
}

.payslip-table .subtotal-row .item-label {
    background: #f0f4ff;
    font-weight: 700;
}

.payslip-table .subtotal-row .item-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1em;
}

.payslip-table .emphasis {
    color: #667eea;
    font-weight: 700;
    font-size: 1.15em;
}

/* 差引支給額 */
.final-amount {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.final-amount-label {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 8px;
}

.final-amount-value {
    font-size: 2em;
    font-weight: bold;
}

/* フッター */
footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 40px;
    opacity: 0.8;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .card {
        padding: 20px;
    }

    h2 {
        font-size: 1.4em;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .payslip-tables {
        grid-template-columns: 1fr;
    }

    .detail-table {
        font-size: 0.85em;
    }

    .detail-table th,
    .detail-table td {
        padding: 10px 8px;
    }

    .btn-large {
        padding: 15px 30px;
        font-size: 1.1em;
    }

    .action-section {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .action-section .btn {
        width: 100%;
        justify-content: center;
    }

    .final-amount-value {
        font-size: 2em;
    }

    .payslip-tables {
        grid-template-columns: 1fr;
    }
}

/* 印刷用スタイル */
@media print {
    @page {
        size: A4;
        margin: 10mm 12mm;
    }

    body {
        background: white;
        padding: 0;
        margin: 0;
    }

    .settings-section,
    .upload-section,
    .action-section,
    header,
    footer {
        display: none !important;
    }

    .card {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    .result-section {
        padding: 0;
        margin: 0;
        transform: scale(0.95);
        transform-origin: top left;
    }

    .payslip-header {
        margin-bottom: 8px;
        padding-bottom: 6px;
        border-bottom-width: 2px;
    }

    .payslip-header h2 {
        font-size: 1.2em;
        margin-bottom: 6px;
    }

    .company-info {
        font-size: 0.75em;
        margin: 6px 0;
    }

    .company-name {
        margin-bottom: 2px;
    }

    .employee-info {
        font-size: 0.85em;
        margin-top: 8px;
    }

    .work-details-section {
        margin-bottom: 10px;
    }

    .work-details-section h3 {
        font-size: 0.95em;
        margin-bottom: 5px;
        padding-bottom: 4px;
    }

    .detail-table {
        margin-bottom: 10px;
        font-size: 0.75em;
    }

    .detail-table th,
    .detail-table td {
        padding: 3px 6px;
        line-height: 1.3;
    }

    .detail-table th {
        font-size: 0.85em;
    }

    .detail-table tfoot .total-row td {
        padding: 4px 6px;
        font-size: 0.9em;
    }

    .payslip-tables {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 10px;
    }

    .payslip-section h3 {
        font-size: 0.9em;
        padding: 4px 6px;
        margin-bottom: 5px;
    }

    .payslip-table {
        font-size: 0.75em;
    }

    .payslip-table td {
        padding: 3px 6px;
        line-height: 1.4;
    }

    .payslip-table .item-label {
        font-size: 0.95em;
    }

    .payslip-table .note-text {
        font-size: 0.8em;
    }

    .payslip-table .subtotal-row td {
        padding: 4px 6px;
    }

    .final-amount {
        padding: 10px;
        margin-top: 10px;
    }

    .final-amount-label {
        font-size: 0.95em;
        margin-bottom: 4px;
    }

    .final-amount-value {
        font-size: 1.4em;
    }
}
