/* 電子契約システム - CSSスタイル */

/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', 'Arial', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-link:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.nav-link.active {
    color: white;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

/* Button Styles */
.btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.btn:active {
}

.btn-secondary {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
}

.btn-danger:hover {
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.6);
}

.btn-success {
    background: linear-gradient(45deg, #51cf66, #40c057);
    box-shadow: 0 4px 20px rgba(81, 207, 102, 0.4);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Container & Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 120px 2rem 2rem;
}

/* Card Styles */
.card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.card:hover {
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 2px solid #e8ecef;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

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

.form-textarea {
    min-height: 150px;
    resize: vertical;
    font-family: inherit;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 16px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 1.2rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 700;
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.table td {
    vertical-align: middle;
}

/* Status Badge */
.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-draft {
    background: linear-gradient(45deg, #fff3cd, #ffeaa7);
    color: #856404;
}

.status-pending {
    background: linear-gradient(45deg, #d1ecf1, #74b9ff);
    color: #0c5460;
}

.status-signed {
    background: linear-gradient(45deg, #d4edda, #00b894);
    color: #155724;
}

.status-cancelled {
    background: linear-gradient(45deg, #f8d7da, #e17055);
    color: #721c24;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.stat-card:hover::before {
    opacity: 1;
    transform: rotate(45deg) translate(50%, 50%);
}

.stat-card:hover {
}

.stat-number {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    opacity: 0.3;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Party Management */
.party-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    align-items: end;
}

.party-item .form-group {
    margin-bottom: 0;
    flex: 1;
}

/* Contract Detail */
.contract-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Alert Messages */
.alert {
    position: fixed;
    top: 100px;
    right: 2rem;
    padding: 1rem 2rem;
    border-radius: 12px;
    z-index: 3000;
    min-width: 350px;
    max-width: 500px;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.alert-success {
    background: linear-gradient(45deg, #51cf66, #40c057);
    color: white;
}

.alert-error {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
}

.alert-info {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Contract Detail Styles */
.contract-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.contract-info-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.contract-info-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.contract-info-value {
    color: #333;
    font-size: 1rem;
}

/* Signature Status */
.signature-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.signature-status.signed {
    color: #28a745;
}

.signature-status.pending {
    color: #ffc107;
}

.signature-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.signature-icon.signed {
    background: #28a745;
}

.signature-icon.pending {
    background: #ffc107;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #51cf66, #40c057);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Enhanced Button Styles */
.btn-outline {
    background: transparent;
    border: 2px solid currentColor;
    color: #667eea;
}

.btn-outline:hover {
    background: currentColor;
    color: white;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Enhanced Form Styles */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-help {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.form-error {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Enhanced Card Styles */
.card-compact {
    padding: 1.5rem;
}

.card-elevated {
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .container {
        padding: 140px 1rem 1rem;
    }

    .card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 16px;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
        width: calc(100% - 2rem);
        border-radius: 16px;
    }

    .party-item {
        flex-direction: column;
        gap: 1rem;
    }

    .action-buttons {
        justify-content: stretch;
    }

    .action-buttons .btn {
        flex: 1;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .table-container {
        border-radius: 12px;
    }

    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.8rem 0.5rem;
    }

    .alert {
        right: 1rem;
        left: 1rem;
        min-width: auto;
        max-width: none;
    }

    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .form-row {
        flex-direction: column;
    }

    .contract-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }

    .card {
        padding: 1rem;
    }

    .modal-content {
        padding: 1rem;
        margin: 0.5rem;
        width: calc(100% - 1rem);
    }

    .stats-grid {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .btn,
    .modal,
    .loading-overlay,
    .alert {
        display: none !important;
    }

    .container {
        padding: 1rem !important;
        max-width: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        margin-bottom: 1rem !important;
        page-break-inside: avoid;
    }

    .contract-content {
        background: white !important;
        border: 1px solid #ddd !important;
    }
}

/* Focus Accessibility */
.btn:focus,
.form-input:focus,
.nav-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #333;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .status-badge {
        border: 1px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* 
    ダークモードサポートは要件に応じて実装
    現在は明るいテーマのみ対応
    */
}

/* 監査ログ専用スタイル */
.action-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.details-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    color: #666;
}

.details-cell:hover {
    overflow: visible;
    white-space: normal;
    word-break: break-word;
}

/* フィルタセレクト */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ページネーション */
#audit-pagination {
    margin-top: 1rem;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

#audit-pagination .btn {
    min-width: 80px;
}

#audit-page-info {
    font-weight: 500;
    color: #666;
    padding: 0 0.5rem;
}

/* 改竄検証専用スタイル */
.verification-result {
    max-height: 70vh;
    overflow-y: auto;
}

.verification-section {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.verification-section h5 {
    margin-bottom: 0.75rem;
    color: #495057;
    font-weight: 600;
}

.verification-item {
    margin: 0.5rem 0;
    padding: 0.25rem 0;
}

.hash-display {
    display: inline-block;
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ced4da;
    font-size: 0.875rem;
    word-break: break-all;
    max-width: 100%;
    margin: 0.25rem 0;
}

.hash-display-small {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #ced4da;
    font-size: 0.75rem;
    word-break: break-all;
    display: inline-block;
}

.signature-verification-item {
    margin: 1rem 0;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

.signature-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.signature-details {
    margin-left: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.signature-details p {
    margin: 0.25rem 0;
}

.verification-status {
    font-weight: 500;
    margin-top: 0.5rem;
}

.text-success {
    color: #28a745;
}

.text-danger {
    color: #dc3545;
}

.text-warning {
    color: #ffc107;
}

.error-list, .warning-list {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.error-list li, .warning-list li {
    margin: 0.25rem 0;
}

/* 警告ボタンスタイル */
.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff8c00 100%);
    color: white;
    border: none;
    font-weight: 500;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800 0%, #e67e00 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}