:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --brand-color: #00c6ff;
    --brand-hover: #00a0d2;
    --brand-grad: linear-gradient(135deg, #00c6ff, #0072ff);

    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --sidebar-width: 250px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Background Glowing Orbs */
.background-decor {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.3;
    animation: drift 20s infinite alternate ease-in-out;
    pointer-events: none;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, #0052d4, #4364f7);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, #8a2387, #e94057);
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, #f2709c, #ff9472);
}

@keyframes drift {
    0% {
        transform: translateY(0) scale(1);
    }

    100% {
        transform: translateY(50px) scale(1.1);
    }
}

/* Layout */
.container {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 100vh;
    position: sticky;
    top: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-link {
    color: var(--text-secondary);
    font-size: 1.2rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--brand-color);
}

.logo-area h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Buttons */
.primary-btn {
    background: var(--brand-grad);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 198, 255, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Categories */
.category-header {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.categories-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 500;
    position: relative;
}

.category-item i {
    width: 20px;
    text-align: center;
}

.category-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.category-item.active {
    color: var(--brand-color);
    background: rgba(0, 198, 255, 0.1);
    font-weight: 600;
}

.count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.active .count {
    background: var(--brand-color);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.header-titles h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    letter-spacing: -1px;
}

.gradient-text {
    background: var(--brand-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Search Bar */
.search-container {
    position: relative;
    width: 350px;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

#searchInput {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 50px;
    border: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#searchInput:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 198, 255, 0.2);
}

/* Prompt Grid */
.prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.prompt-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.prompt-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-category {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    display: inline-block;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn.delete-btn:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.card-content {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    height: 100px;
    overflow-y: hidden;
    position: relative;
}

/* 霧のグラデーションで続きがあるように見せる */
.card-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.8));
    border-radius: 0 0 8px 8px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.tag {
    font-size: 0.75rem;
    color: var(--brand-color);
    background: rgba(0, 198, 255, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
}

.copy-btn {
    width: 100%;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.copy-btn.copied {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    text-align: center;
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: 16px;
}

.empty-state.hidden {
    display: none;
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.mt-3 {
    margin-top: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    transform: translateY(0);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* プレビュー画面固有のスタイル */
.preview-content-wrapper {
    max-width: 900px;
}

.preview-body {
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    border-radius: 12px;
    color: var(--text-primary);
    line-height: 1.8;
    letter-spacing: 0.03em;
    font-size: 1.05rem;
    max-height: 50vh;
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
    /* スクロールバーのスタイリング */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.preview-body::-webkit-scrollbar {
    width: 6px;
}

.preview-body::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Markdownのスタイリング */
.preview-body h1,
.preview-body h2,
.preview-body h3,
.preview-body h4 {
    color: white;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.preview-body h1 {
    font-size: 1.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.preview-body h2 {
    font-size: 1.5rem;
}

.preview-body h3 {
    font-size: 1.3rem;
}

.preview-body p {
    margin-bottom: 1rem;
}

.preview-body ul,
.preview-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.preview-body li {
    margin-bottom: 0.3rem;
}

.preview-body pre {
    background: #0f172a;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-body code {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.preview-body pre code {
    background: none;
    padding: 0;
}

.preview-body blockquote {
    border-left: 4px solid var(--brand-color);
    padding-left: 1rem;
    color: var(--text-secondary);
    background: rgba(0, 198, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1rem;
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

/* AI Formatter Button */
.ai-btn {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.ai-btn:active {
    transform: translateY(0);
}

.ai-btn i {
    font-size: 1.1rem;
}

/* AI Loading Spinner */
.ai-spinner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #a8ff78;
    animation: ai-spin 1s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(168, 255, 120, 0.4);
}

@keyframes ai-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Settings Modal Specific */
#geminiApiKey {
    font-family: monospace;
    letter-spacing: 1px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--danger-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--brand-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    .logo-area {
        width: 100%;
        margin-bottom: 1rem;
    }

    .categories-list {
        width: 100%;
    }

    .categories-list ul {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .category-item {
        flex: 1;
        min-width: 120px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .search-container {
        width: 100%;
    }
}