/* Similar Font Finder - Main Stylesheet */

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

:root {
    /* ライトモードのカラー変数 */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-color: #333;
    --card-bg: #ffffff;
    --card-text: #333333;
    --card-border: #e9ecef;
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-focus: rgba(102, 126, 234, 0.5);
    --header-bg: rgba(255, 255, 255, 0.1);
    --controls-bg: rgba(255, 255, 255, 0.1);
    --suggestion-bg: rgba(255, 255, 255, 0.2);
    --suggestion-hover: rgba(255, 255, 255, 0.3);
    --white-text: white;
}

[data-theme="dark"] {
    /* ダークモードのカラー変数 */
    --bg-gradient: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    --text-color: #e2e8f0;
    --card-bg: #2d3748;
    --card-text: #e2e8f0;
    --card-border: #4a5568;
    --input-bg: rgba(45, 55, 72, 0.9);
    --input-focus: rgba(102, 126, 234, 0.7);
    --header-bg: rgba(45, 55, 72, 0.3);
    --controls-bg: rgba(45, 55, 72, 0.3);
    --suggestion-bg: rgba(45, 55, 72, 0.4);
    --suggestion-hover: rgba(45, 55, 72, 0.6);
    --white-text: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-gradient);
    min-height: 100vh;
    transition: all 0.3s ease;
}

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

/* Header */
.header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem 0;
}

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

.header-main {
    text-align: center;
    flex: 1;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    color: var(--white-text);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tagline {
    font-size: 1.2rem;
    color: var(--white-text);
    font-weight: 300;
    opacity: 0.9;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
}

.theme-toggle-btn {
    background: var(--controls-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--suggestion-hover);
}


/* Main Content */
.main {
    padding: 3rem 0;
    flex: 1;
    min-height: calc(100vh - 200px);
}

/* Search Section */
.search-section {
    text-align: center;
    margin-bottom: 4rem;
    padding: 0 1rem;
}

.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    background: white;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: none;
    outline: none;
    background: transparent;
}

.search-input::placeholder {
    color: #aaa;
}

.search-button {
    padding: 1rem 2rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-button:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
    transform: translateY(-1px);
}

.search-suggestions {
    color: rgba(255, 255, 255, 0.8);
}

.suggestion-tag {
    background: var(--suggestion-bg);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    margin: 0 0.5rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.suggestion-tag:hover {
    background: var(--suggestion-hover);
}

/* Preview Controls */
.preview-controls {
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeIn 0.5s ease-in 0.3s forwards;
    padding: 0 1rem;
}

.controls-panel {
    background: var(--controls-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-group label {
    color: var(--white-text);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.control-group input[type="text"] {
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--card-text);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.control-group input[type="text"]:focus {
    outline: none;
    background: var(--card-bg);
    box-shadow: 0 0 0 2px var(--input-focus);
}

#fontSizeValue {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    font-size: 0.9rem;
}

/* Results Section */
.results-section {
    min-height: 400px;
    padding: 0 1rem;
}

.loading {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    padding: 2rem;
    display: none;
}

.loading.show {
    display: block;
}

.no-results {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    padding: 2rem;
    display: none;
}

.no-results.show {
    display: block;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
    padding: 0;
}

.font-card {
    background: var(--card-bg);
    color: var(--card-text);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease;
    min-height: 420px;
    border: 1px solid var(--card-border);
}

.font-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

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

.font-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--card-text);
}

.similarity-score {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.font-comparison {
    margin: 2rem 0;
}

.font-preview-section {
    margin-bottom: 1.5rem;
}

.font-type-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    display: inline-block;
}

.font-type-label.paid {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
}

.font-type-label.free {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.font-preview {
    padding: 1.5rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-weight: 400;
    text-align: center;
    border: 1px solid #e9ecef;
    margin-top: 0.5rem;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    transition: font-size 0.3s ease;
    color: #333333 !important;
}

.paid-font {
    border-left: 4px solid #dc3545;
}

.free-font {
    border-left: 4px solid #28a745;
}

.vs-divider {
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #6c757d;
    margin: 1rem 0;
    position: relative;
}

.vs-divider::before,
.vs-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: #dee2e6;
}

.vs-divider::before {
    left: 0;
}

.vs-divider::after {
    right: 0;
}

.font-info {
    margin-bottom: 1.5rem;
}

.font-category {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.font-source {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.font-actions {
    display: flex;
    gap: 1rem;
}

.download-btn {
    flex: 1;
    padding: 0.8rem;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.download-btn:hover {
    background: linear-gradient(45deg, #218838, #1ba085);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2.5rem 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4rem;
}

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

    .header-main {
        order: 1;
    }

    .theme-toggle {
        order: 0;
        align-self: flex-end;
    }

    .logo {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .search-box {
        flex-direction: column;
        border-radius: 15px;
    }
    
    .search-button {
        border-radius: 0 0 15px 15px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .controls-panel {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* AI分析関連のスタイル */
.ai-analysis-tag {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(238, 90, 36, 0.3);
    white-space: nowrap;
}

.ai-reason {
    background: #f8f9fa;
    border-left: 4px solid #ff6b6b;
    padding: 12px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.9em;
    color: #495057;
    line-height: 1.5;
}

.ai-reason strong {
    color: #ff6b6b;
    font-weight: 700;
}

/* フォント読み込み中のスタイル */
.font-loading {
    position: relative;
    color: #aaa;
}

.font-loading::after {
    content: ' (読み込み中...)';
    font-size: 0.8em;
    color: #666;
    font-style: italic;
}