/**
 * Mecatoncheir Platform - Minimal Styles
 */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: translateY(-1px);
    filter: drop-shadow(0 4px 8px rgba(255, 255, 255, 0.2));
}

.logo-image {
    height: 40px;
    width: auto;
    transition: filter 0.3s ease;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.logo:hover {
    color: #e0e7ff;
}

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

.nav-link {
    font-size: 1rem;
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #e0e7ff;
    text-shadow: 0 0 8px rgba(224, 231, 255, 0.5);
}

.nav-link.active {
    color: #ffffff;
    font-weight: 600;
    border-bottom: 2px solid #ffffff;
    padding-bottom: 4px;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

/* Main Content */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    color: #6b7280;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn-primary {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: transparent;
    color: #2563eb;
    border: 1px solid #2563eb;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #2563eb;
    color: white;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Cards */
.card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2,
.card-header h3 {
    margin: 0;
    color: #1f2937;
}

.card-body {
    padding: 1.5rem;
}

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

/* ===== 共通アプリ・APIアイテム表示 ===== */
.app-item, .api-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.app-item:hover, .api-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.app-item-header, .api-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.app-item-title, .api-item-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    margin-right: 1rem;
}

.app-item-description, .api-item-description {
    color: #6b7280;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.app-item-meta, .api-item-meta {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.app-item-actions, .api-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ステータス表示 */
.app-status, .api-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-draft {
    background-color: #fef3c7;
    color: #92400e;
}

.status-unknown {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* 共通メッセージ表示 */
.loading-message, .empty-message, .error-message, .login-required {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.loading-message .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

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

.empty-message h3, .error-message h3, .login-required h3 {
    margin-bottom: 1rem;
    color: #374151;
}

.empty-message p, .error-message p, .login-required p {
    margin-bottom: 1.5rem;
}

.error-message {
    color: #dc2626;
}

.error-detail {
    font-size: 0.875rem;
    color: #6b7280;
    font-family: monospace;
    background: #f9fafb;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.error-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Login Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.modal-close:hover {
    color: #374151;
}

.auth-form {
    padding: 1.5rem;
}

/* Utilities */
.hidden {
    display: none;
}

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

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

.mt-4 {
    margin-top: 1.5rem;
}

.no-apis {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #5a91e9 0%, #2a87b3 100%);
    color: white;
    padding: 4rem 0;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 3rem;
}

.hero-content {
    flex: 1;
    text-align: left;
}

.hero-image {
    flex: 1;
    text-align: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.hero-description {
    font-size: 1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary.large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-secondary.large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 1rem 20px;
    }
    
    .nav {
        flex-direction: column;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .hero-container {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
    
    .hero-content {
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .api-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Multi-tenant UI Styles */
.tenant-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
}

.tenant-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tenant-selector label {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.form-control-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.tenant-info {
    font-size: 0.85rem;
    color: #666;
    background: #f8f9fa;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
}

.user-role-info {
    font-size: 0.85rem;
    color: #007bff;
    font-weight: 500;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #007bff;
}

.hidden {
    display: none !important;
}

/* Responsive adjustments for tenant UI */
@media (max-width: 768px) {
    .tenant-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-top: 1rem;
        padding: 0;
    }
    
    .tenant-selector {
        width: 100%;
    }
    
    .tenant-selector select {
        flex: 1;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header-container {
        align-items: flex-start;
    }
}

/* Description Section Styles */
.description-section {
    background: #f8f9fa;
    padding: 4rem 0;
}

.description-block {
    background: white;
    border-radius: 12px;
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.description-block:last-child {
    margin-bottom: 0;
}

.description-block h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 600;
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.5rem;
}

.description-block h3 {
    color: #34495e;
    margin: 2rem 0 1.5rem 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.description-block p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
}

.description-block ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.description-block ol li {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #555;
}

.description-block a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.description-block a:hover {
    text-decoration: underline;
}

/* Flow Content Layout */
.flow-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    margin-top: 2rem;
}

.flow-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Vision Content Layout */
.vision-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.vision-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Developer Content Layout */
.developer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.developer-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Responsive Design for Description Section */
@media (max-width: 768px) {
    .description-section {
        padding: 2rem 0;
    }
    
    .description-block {
        padding: 2rem 1.5rem;
        margin-bottom: 2rem;
    }
    
    .description-block h2 {
        font-size: 1.6rem;
    }
    
    .flow-content,
    .vision-content,
    .developer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .flow-image,
    .vision-image,
    .developer-image {
        text-align: center;
    }
}

/* Settings Modal Styles */
.btn-icon {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    margin-right: 0.5rem;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
}

.account-label {
    margin-right: 0.5rem;
    font-weight: 500;
    color: #666;
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h4 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.cooldown-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    font-size: 0.9rem;
}

.form-help {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
    display: block;
}

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

.mt-2 {
    margin-top: 0.5rem;
}

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

.mt-4 {
    margin-top: 1.5rem;
}

/* Auth controls layout update */
.auth-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-controls span {
    white-space: nowrap;
}

/* Form validation styles */
.form-control.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

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

.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

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