/* 
 * Hayane Unified Design System
 * Modern, Clean, Professional UI
 */

:root {
    /* --- アクセシビリティ・テーマ用変数 --- */
    .theme-white {
        --primary-600: #ffffff;
        --secondary-600: #cccccc;
        --gray-900: #000000;
        --gray-800: #222222;
        --gray-700: #333333;
        --gray-600: #444444;
        --gray-500: #555555;
        --gray-400: #888888;
        --gray-300: #bbbbbb;
        --gray-200: #e0e0e0;
        --gray-100: #f5f5f5;
        --gray-50: #ffffff;
        --success: #007700;
        --danger: #bb2222;
        --info: #0055bb;
        --warning: #bb9900;
        background: #fff !important;
        color: #000 !important;
    }

    .theme-black {
        --primary-600: #222222;
        --secondary-600: #444444;
        --gray-900: #ffffff;
        --gray-800: #eeeeee;
        --gray-700: #cccccc;
        --gray-600: #bbbbbb;
        --gray-500: #888888;
        --gray-400: #555555;
        --gray-300: #333333;
        --gray-200: #222222;
        --gray-100: #111111;
        --gray-50: #000000;
        --success: #33ff99;
        --danger: #ff6666;
        --info: #66aaff;
        --warning: #ffe066;
        background: #000 !important;
        color: #fff !important;
    }

    /* テキストベースモード（視覚障害者向け）: 高コントラスト・大きな文字・下線リンク */
    .theme-text {
        --primary-600: #000000;
        --secondary-600: #000000;
        --gray-900: #000000;
        --gray-800: #000000;
        --gray-700: #000000;
        --gray-600: #000000;
        --gray-500: #000000;
        --gray-400: #000000;
        --gray-300: #000000;
        --gray-200: #ffffff;
        --gray-100: #ffffff;
        --gray-50: #ffffff;
        --success: #000000;
        --danger: #000000;
        --info: #000000;
        --warning: #000000;
        background: #fff !important;
        color: #000 !important;
        font-size: 1.3em !important;
        letter-spacing: 0.05em !important;
    }

    .theme-text *, .theme-text input, .theme-text button, .theme-text label, .theme-text select, .theme-text textarea {
        font-size: 1.2em !important;
        color: #000 !important;
        background: #fff !important;
        border-color: #000 !important;
    }
    .theme-text a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    .theme-text .btn, .theme-text .btn-primary, .theme-text .btn-secondary, .theme-text .btn-success {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
    }
    .theme-text .card, .theme-text .login-card {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
    }
    .theme-text .form-input, .theme-text .form-select, .theme-text .form-textarea {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000 !important;
    }
    .theme-text .alert {
        background: #fff !important;
        color: #000 !important;
        border-left: 4px solid #000 !important;
    }
    /* Primary Colors - Deep Blue Theme */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Secondary Colors - Purple Accent */
    --secondary-500: #8b5cf6;
    --secondary-600: #7c3aed;
    --secondary-700: #6d28d9;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic Pro', 'Meiryo', 'Noto Sans JP', sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--gray-900);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* Card */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--secondary-600) 100%);
    color: white;
    padding: var(--space-xl);
}

.card-body {
    padding: var(--space-xl);
}

.card-footer {
    background: var(--gray-50);
    padding: var(--space-lg);
    border-top: 1px solid var(--gray-200);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-600);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-ghost {
    background: transparent;
    color: var(--primary-600);
    border: 1px solid var(--primary-600);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--primary-50);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.625rem;
    aspect-ratio: 1;
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--gray-800);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-helper {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: var(--space-xs);
}

.form-error {
    color: var(--danger);
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--secondary-600) 100%);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
}

tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--gray-50);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: var(--space-md) var(--space-lg);
    font-size: 0.9375rem;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-800);
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-info {
    background: var(--info-light);
    color: var(--primary-800);
}

/* Alert */
.alert {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border-left: 4px solid;
    margin-bottom: var(--space-lg);
}

.alert-success {
    background: var(--success-light);
    border-color: var(--success);
    color: #065f46;
}

.alert-warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: #92400e;
}

.alert-danger {
    background: var(--danger-light);
    border-color: var(--danger);
    color: #991b1b;
}

.alert-info {
    background: var(--info-light);
    border-color: var(--info);
    color: var(--primary-800);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--secondary-600) 100%);
    color: white;
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
}

.header-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.header-subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

/* Tabs */
.tabs {
    display: flex;
    gap: var(--space-sm);
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: var(--space-xl);
    overflow-x: auto;
}

.tab {
    padding: var(--space-md) var(--space-xl);
    font-weight: 600;
    color: var(--gray-600);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.tab:hover {
    color: var(--primary-600);
    background: var(--primary-50);
}

.tab.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

.tab-content {
    display: none;
}

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

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

.status-processing {
    background: var(--info-light);
    color: var(--primary-800);
}

.status-processing::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-600);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-completed {
    background: var(--success-light);
    color: #065f46;
}

.status-completed::before {
    content: '✓';
    font-weight: 700;
}

.status-error {
    background: var(--danger-light);
    color: #991b1b;
}

.status-error::before {
    content: '✕';
    font-weight: 700;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
}

.modal-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--gray-200);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-body {
    padding: var(--space-xl);
}

.modal-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-sm); }
.gap-2 { gap: var(--space-md); }
.gap-3 { gap: var(--space-lg); }

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
    
    .header {
        padding: var(--space-lg);
    }
    
    .card-body {
        padding: var(--space-lg);
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}
