:root {
    --primary-color: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    padding: 2rem 0;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #ec4899;
    bottom: -50px;
    left: -50px;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #06b6d4;
    top: 40%;
    left: 10%;
}

.app-header {
    text-align: center;
    padding: 3rem 0 0;
    width: 100%;
    z-index: 10;
}

.main-logo {
    width: 160px;
    height: auto;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 20px rgba(79, 70, 229, 0.4));
}

.main-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header .subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: none;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card.active {
    display: block;
}

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

h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

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

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

button {
    width: 100%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 1rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

button:active {
    transform: translateY(0);
}

/* Auth Section */
.auth-loading {
    text-align: center;
}

.kakao-icon {
    width: 60px;
    height: 60px;
    background: #FEE500;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
}

.kakao-icon img {
    width: 35px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #6366f1;
    border-radius: 50%;
    margin: 2rem auto;
    animation: spin 1s linear infinite;
}

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

/* Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

/* Home Section */
.home-container {
    display: flex;
    gap: 3.5rem;
    min-height: 320px;
    align-items: stretch;
    padding: 1rem 0;
}

.home-left {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
}

.home-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-left: 1rem;
}

.home-divider {
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.big-btn {
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.big-btn:hover {
    transform: translateY(-8px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(79, 70, 229, 0.3);
}

.big-btn .icon {
    font-size: 5rem;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

.big-btn .text {
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.home-right-header {
    text-align: left;
    margin-bottom: 2rem;
}

.title-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.home-right-header h3 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.icon-btn-text {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: auto;
    margin: 0;
}

.icon-btn-text:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
}

.home-right-header .subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.file-info {
    flex: 1;
    padding-right: 1rem;
}

.file-list {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 1.25rem;
    overflow-y: auto;
    max-height: 380px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.file-item {
    background: rgba(255, 255, 255, 0.04);
    padding: 1.25rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.005);
}

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.file-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

.file-item .filename {
    font-weight: 600;
    font-size: 1.05rem;
    display: block;
    margin-bottom: 0.25rem;
}

.file-item .date {
    font-size: 0.85rem;
    color: #94a3b8;
}

.small-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.small-btn:hover {
    background: var(--secondary-color);
}

.empty-msg {
    text-align: center;
    color: #64748b;
    margin-top: 2rem;
}

/* Save Section */
.save-content {
    text-align: center;
    padding: 2rem;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.save-info {
    font-weight: 700;
    color: var(--primary-color);
    margin: 1rem 0 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.main-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.main-actions button {
    flex: 1;
}

.result-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.step-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
    position: relative;
}

.step-header h2 {
    margin-bottom: 0;
    font-size: 1.8rem;
    font-weight: 800;
}

.back-home-btn {
    position: absolute;
    right: 0;
    width: auto;
    margin-top: 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
    font-weight: 500;
}

/* Error Section */
.error-content {
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

#error-message {
    color: #fca5a5;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Result Section */
#step-result {
    max-width: 900px;
    width: 90vw;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.result-header button {
    width: auto;
    margin-top: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.ai-opinion-section {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid #6366f1;
    padding: 1.5rem;
    border-radius: 0 16px 16px 0;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.ai-opinion-section h3 {
    margin-bottom: 1rem;
    color: #a5b4fc;
}

.markdown-body {
    white-space: normal;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1.5rem 0;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 0.5rem 0 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    margin: 1rem 0;
    font-style: italic;
}

.table-container {
    overflow-x: auto;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

tr:last-child td {
    border-bottom: none;
}
