/* ==========================================
   管理画面用スタイル
   ========================================== */
:root {
    --primary-color: #FF9D5C;
    --primary-dark: #FF7A33;
    --secondary-color: #FFD4A3;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    
    --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;
    
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-white: #FFFFFF;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --transition: 0.3s ease;
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--gray-50);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ==========================================
   ヘッダー
   ========================================== */
.admin-header {
    background-color: var(--text-white);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--gray-100);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-back:hover {
    background-color: var(--gray-200);
}

/* ==========================================
   メインコンテンツ
   ========================================== */
.admin-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* 統計情報 */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--text-white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.stat-content h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* アクションセクション */
.action-section {
    margin-bottom: 2rem;
}

/* テーブルセクション */
.table-section {
    background-color: var(--text-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.table-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.625rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.9375rem;
    background-color: var(--text-white);
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* テーブル */
.table-wrapper {
    overflow-x: auto;
}

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

.data-table thead {
    background-color: var(--gray-100);
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: var(--gray-50);
}

.company-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    background-color: var(--gray-100);
    padding: 0.5rem;
}

.company-name-text {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--gray-100);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
}

.industry-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.industry-badge.it {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.industry-badge.medical {
    background-color: #FEE2E2;
    color: #991B1B;
}

.industry-badge.driver {
    background-color: #FEF3C7;
    color: #92400E;
}

.industry-badge.other {
    background-color: var(--gray-200);
    color: var(--text-primary);
}

.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.status-badge.active {
    background-color: #D1FAE5;
    color: #065F46;
}

.status-badge.inactive {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 1rem;
}

.btn-icon.edit {
    color: var(--primary-color);
}

.btn-icon.edit:hover {
    background-color: #EEF2FF;
}

.btn-icon.delete {
    color: var(--danger-color);
}

.btn-icon.delete:hover {
    background-color: #FEE2E2;
}

.loading-cell {
    text-align: center;
    padding: 3rem !important;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

/* ==========================================
   ボタン
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Noto Sans JP', sans-serif;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
}

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

.btn-danger:hover {
    background-color: #DC2626;
}

/* ==========================================
   モーダル
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--text-white);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

.modal-small {
    max-width: 400px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-200);
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    background-color: var(--gray-100);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--gray-200);
}

/* フォーム */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.required {
    color: var(--danger-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-group {
    margin-top: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* 削除確認 */
.delete-warning {
    text-align: center;
    padding: 1rem 0;
}

.delete-warning i {
    font-size: 3rem;
    color: var(--warning-color);
    margin-bottom: 1rem;
}

.delete-company-name {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
    margin: 1rem 0;
}

.warning-text {
    color: var(--danger-color);
    font-weight: 600;
    margin-top: 1rem;
}

/* ==========================================
   トースト通知
   ========================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--secondary-color);
    color: var(--text-white);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    display: none;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    z-index: 2000;
    animation: toastSlideIn 0.3s ease;
}

.toast.show {
    display: flex;
}

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

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

/* ==========================================
   レスポンシブ
   ========================================== */
@media (max-width: 768px) {
    /* モバイル版管理画面をコンパクトに */
    .admin-header {
        padding: 0.75rem 0;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .logo h1 {
        font-size: 1rem;
    }
    
    .admin-main {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.375rem;
        margin-bottom: 1rem;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .table-title {
        font-size: 1.125rem;
    }
    
    .filters {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .filters select {
        width: 100%;
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .table-section {
        padding: 0.75rem;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 1rem auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .form-group label {
        font-size: 0.875rem;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.125rem;
    }
    
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        font-size: 0.875rem;
        padding: 0.875rem 1rem;
    }
}

@media (max-width: 480px) {
    /* 超小型スマホ用 */
    .logo h1 {
        font-size: 0.9rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 0.875rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .table-section {
        padding: 0.5rem;
    }
    
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.35rem;
        font-size: 0.75rem;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 98%;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.875rem;
    }
}