:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-start: #a855f7;
    --accent-end: #ec4899;
    --accent-gradient: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

header h1 span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-style: italic;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 992px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.8s ease;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #cbd5e1;
}

.badge {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

input, textarea, select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-start);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
    pointer-events: none;
}

select {
    appearance: none;
    cursor: pointer;
}

.api-key-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.generate-btn {
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 2rem;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(168, 85, 247, 0.5);
}

.generate-btn:active {
    transform: translateY(0);
}

.loading {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--accent-start);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(168, 85, 247, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-start);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 0.5rem;
}

.hidden {
    display: none !important;
}

.error-msg {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 0.9rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--accent-start);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* Output Area */
.result-container {
    height: 100%;
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.tab-content {
    flex-grow: 1;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Slide Cards */
.slide-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

.slide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.slide-number {
    background: var(--accent-gradient);
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
}

.slide-purpose {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.slide-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #e2e8f0;
}

.slide-content p {
    font-size: 0.95rem;
    color: #cbd5e1;
    white-space: pre-wrap;
}

/* Caption and Hashtags */
.text-output-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 1rem;
    color: #e2e8f0;
    white-space: pre-wrap;
    line-height: 1.8;
}

.hashtag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hashtag-pill {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #d8b4fe;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.2s;
    cursor: default;
}

.hashtag-pill:hover {
    background: rgba(168, 85, 247, 0.25);
    transform: translateY(-1px);
}

/* CSV Button */
.slides-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.csv-btn {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.csv-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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