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

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

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

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
}

.header-controls {
    display: flex;
    align-items: center;
}

.language-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    background: white;
    font-size: 0.9rem;
}

/* Main Content */
.main {
    padding: 2rem 0;
    flex: 1;
}

.app-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}

/* Input Section */
.input-section, .output-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.input-section h2, .output-section h2 {
    margin-bottom: 1rem;
    color: #374151;
    font-weight: 600;
}

.input-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

#input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 200px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

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

.input-info {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Button Styles */
.summarize-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.summarize-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.summarize-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Output Section */
.output-wrapper {
    position: relative;
}

.output-content {
    min-height: 200px;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #f9fafb;
    line-height: 1.7;
    white-space: pre-wrap;
}

.output-placeholder {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.output-content.has-content {
    background: white;
    border-color: #d1fae5;
}

.output-content.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.output-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #e5e7eb;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    margin-top: 2rem;
}

.footer-content {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #4b5563;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-link {
    position: relative;
    display: inline-block;
}

.footer-link-text {
    color: #2563eb;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.footer-link-text:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

.footer-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.4;
    max-width: 300px;
    width: max-content;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.footer-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.footer-link:hover .footer-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}

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

.footer-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.footer-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #6b7280;
}

.footer-modal-close:hover {
    background: #e5e7eb;
}

.footer-modal h3 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.footer-modal h4 {
    color: #374151;
    margin: 1rem 0 0.5rem 0;
    font-size: 1rem;
}

.footer-modal p {
    margin-bottom: 0.75rem;
    color: #4b5563;
}

.footer-modal a {
    color: #2563eb;
    text-decoration: none;
}

.footer-modal a:hover {
    text-decoration: underline;
}

.copyright {
    margin-top: 1rem;
    color: #6b7280;
    font-size: 0.75rem;
}

/* Responsive Design */
@media (min-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
    
    .container {
        padding: 0 2rem;
    }
    
    .main {
        padding: 3rem 0;
    }
    
    .input-section, .output-section {
        padding: 2rem;
    }
    
    .logo {
        font-size: 1.75rem;
    }
}

@media (min-width: 1024px) {
    .main {
        padding: 4rem 0;
    }
    
    .app-grid {
        gap: 3rem;
    }
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    .input-section, .output-section {
        border: 2px solid #000;
    }
    
    #input, .output-content {
        border: 2px solid #000;
    }
}

/* Print styles */
@media print {
    .header, .footer, .summarize-btn, .output-actions {
        display: none;
    }
    
    .main {
        padding: 0;
    }
    
    .app-grid {
        display: block;
    }
    
    .input-section, .output-section {
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #000;
    }
}

.header-title {
    flex: 1;
}

.subtitle {
    font-size: 0.9rem;
    color: #4b5563;
    margin-top: 0.25rem;
}

.mode-selector {
    display: flex;
    margin-bottom: 1rem;
    background: #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.25rem;
}

.mode-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.translation-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: #f3f4f6;
    padding: 0.5rem;
    border-radius: 0.75rem;
}

.translation-controls select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    background: white;
    font-size: 0.9rem;
}

.translation-controls .arrow {
    font-size: 1.2rem;
    color: #6b7280;
}

/* Related Sites Section */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #6b7280;
    --success-color: #059669;
    --card-bg: rgba(255, 255, 255, 0.95);
    --border-color: rgba(229, 231, 235, 0.8);
}

.related-sites-section {
    margin-bottom: 2rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.related-sites-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
    text-align: center;
}

.related-sites-description {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.sites-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.category {
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.category h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.sites-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sites-list li {
    margin-bottom: 0.5rem;
}

.sites-list a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.sites-list a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.current-site {
    color: var(--success-color);
    font-weight: 500;
    font-size: 0.9rem;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .sites-categories {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .category {
        padding: 0.75rem;
    }

    .related-sites-section h3 {
        font-size: 1.1rem;
    }
}
