:root {
    --primary-color: #232f3e;
    --primary-gradient: linear-gradient(135deg, #232f3e 0%, #37475a 100%);
    --secondary-color: #f8f8f8;
    --accent-color: #ff9900;
    --accent-gradient: linear-gradient(135deg, #ff9900 0%, #ffb700 100%);
    --text-color: #333333;
    --border-color: #e6e6e6;
    --success-color: #067d62;
    --success-gradient: linear-gradient(135deg, #067d62 0%, #09977a 100%);
    --warning-color: #ff9900;
    --warning-gradient: linear-gradient(135deg, #ff9900 0%, #ffb700 100%);
    --danger-color: #d63031;
    --danger-gradient: linear-gradient(135deg, #d63031 0%, #ff4757 100%);
    --header-height: 60px;
    --sidebar-width: 240px;
    --card-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 4px 8px rgba(0,0,0,0.06);
    --hover-shadow: 0 4px 8px rgba(0,0,0,0.08), 0 8px 16px rgba(0,0,0,0.12);
    --container-max-width: 1400px;
    --container-padding: 2rem;
    --grid-gap: 1.5rem;
}

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

html {
    overflow-y: scroll;
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: "Amazon Ember", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--secondary-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

.container {
    max-width: var(--container-max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--primary-gradient);
    width: 100%;
    color: white;
    box-shadow: var(--card-shadow);
}

.main-nav {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
    align-items: center;
    flex-wrap: nowrap;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-links a:hover::after {
    width: 80%;
}

main {
    margin-top: var(--header-height);
    flex: 1;
    width: 100%;
    padding: 2rem 0;
}

.dashboard {
    margin-bottom: 3rem;
}

.dashboard h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 1rem;
    display: inline-block;
}

.dashboard h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
    transform: scaleX(0.3);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.dashboard h1:hover::after {
    transform: scaleX(1);
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--grid-gap);
    margin-top: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    width: 100%;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-gradient);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
}

.stat-card h3 {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-card p {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--grid-gap);
    margin-top: 2rem;
    width: 100%;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    width: 100%;
    border: 1px solid var(--border-color);
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
}

.product-info {
    padding: 1.5rem;
}

.product-info h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.product-info p {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.product-info p:last-child {
    border-bottom: none;
}

.product-info p span:first-child {
    color: #666;
    font-size: 0.9rem;
}

.product-info p span:last-child {
    font-weight: 600;
    color: var(--primary-color);
}

.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--grid-gap);
    margin-top: 2rem;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.chart-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
}

.chart-card h3 {
    color: var(--text-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9;
}

footer {
    text-align: center;
    padding: 2rem;
    background: var(--primary-gradient);
    margin-top: auto;
    width: 100%;
    color: white;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

/* 등급 뱃지 스타일 */
.grade {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
    min-width: 60px;
}

.grade-A {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 2px 4px rgba(6, 125, 98, 0.2);
}

.grade-B {
    background: var(--warning-gradient);
    color: white;
    box-shadow: 0 2px 4px rgba(255, 153, 0, 0.2);
}

.grade-C {
    background: var(--danger-gradient);
    color: white;
    box-shadow: 0 2px 4px rgba(214, 48, 49, 0.2);
}

/* 인증 관련 스타일 */
body:not(.logged-in) .auth-required {
    display: none !important;
}

body.logged-in #loginBtn {
    display: none !important;
}

body:not(.logged-in) #logoutBtn {
    display: none !important;
}

body.logged-in #logoutBtn {
    display: block !important;
}

/* 모바일 메뉴 버튼 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-icon {
    display: block;
    width: 24px;
    height: 2px;
    background-color: white;
    position: relative;
    transition: all 0.3s ease;
}

.menu-icon::before,
.menu-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: white;
    transition: all 0.3s ease;
}

.menu-icon::before {
    transform: translateY(-6px);
}

.menu-icon::after {
    transform: translateY(6px);
}

.menu-toggle.active .menu-icon {
    background-color: transparent;
}

.menu-toggle.active .menu-icon::before {
    transform: rotate(45deg);
}

.menu-toggle.active .menu-icon::after {
    transform: rotate(-45deg);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 모바일 대응 */
@media (max-width: 1200px) {
    :root {
        --container-padding: 1.5rem;
    }
    
    .chart-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 1rem;
        --grid-gap: 1rem;
    }

    .main-nav {
        padding: 0 var(--container-padding);
    }

    .nav-links {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    .nav-links.active {
        transform: translateY(0);
    }

    .nav-links a {
        padding: 0.75rem 1rem;
        width: 100%;
        justify-content: center;
    }

    .menu-toggle {
        display: block;
    }

    .stats-container,
    .product-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    :root {
        --container-padding: 0.75rem;
    }

    .stat-card,
    .product-card,
    .chart-card {
        border-radius: 8px;
        padding: 1rem;
    }
}

/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-color);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--warning-gradient);
}

/* 히스토리 메뉴 스타일 */
#historyBtn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#historyBtn::before {
    content: '⏱';
    font-size: 1.1em;
}

#historyBtn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: right;
}

#historyBtn:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* 섹션 제목 공통 스타일 */
section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 0.75rem;
    display: inline-block;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px;
    transform: scaleX(0.5);
    transform-origin: left;
    transition: transform 0.3s ease;
}

section h2:hover::after {
    transform: scaleX(1);
}

/* Prompt Builder 스타일 */
.prompt-builder {
    margin-bottom: 3rem;
}

.prompt-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--grid-gap);
    margin-top: 2rem;
}

.prompt-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--grid-gap);
}

.prompt-templates,
.prompt-saved {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

.prompt-templates h3,
.prompt-saved h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.template-list,
.saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.template-btn {
    padding: 0.75rem 1rem;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-color);
}

.template-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(4px);
}

.saved-item {
    padding: 0.75rem 1rem;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saved-item:hover {
    background: var(--accent-color);
    color: white;
    transform: translateX(4px);
}

.saved-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-item-delete {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.saved-item:hover .saved-item-delete {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.empty-message {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    font-style: italic;
}

.prompt-editor {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.prompt-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.prompt-title-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.prompt-title-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.1);
}

.prompt-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 153, 0, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.prompt-input-wrapper {
    position: relative;
    flex: 1;
    min-height: 400px;
}

.prompt-input {
    width: 100%;
    height: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
}

.prompt-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.1);
}

.prompt-stats {
    position: absolute;
    bottom: 0.75rem;
    right: 1rem;
    font-size: 0.85rem;
    color: #999;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.prompt-preview {
    background: var(--secondary-color);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.prompt-preview h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.preview-content {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}

@media (max-width: 1200px) {
    .prompt-container {
        grid-template-columns: 1fr;
    }
    
    .prompt-sidebar {
        order: 2;
    }
    
    .prompt-editor {
        order: 1;
    }
} 