/* 교정학 학습 플랫폼 - 프리미엄 테마 */

:root {
    --primary: #0066CC;
    --primary-light: #3399FF;
    --primary-dark: #003399;
    --secondary: #00A8E8;
    --secondary-light: #00D4FF;
    --secondary-dark: #0066B2;
    --success: #00AA55;
    --warning: #FF9900;
    --danger: #FF3333;
    --dark: #0D1117;
    --light: #F6F8FB;
    --border: #D0D7DE;
    --shadow-sm: 0 1px 3px rgba(13, 17, 23, 0.08);
    --shadow-md: 0 3px 12px rgba(13, 17, 23, 0.12);
    --shadow-lg: 0 8px 24px rgba(13, 17, 23, 0.15);
    --shadow-xl: 0 12px 32px rgba(13, 17, 23, 0.18);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #F6F8FB 0%, #FFFFFF 100%);
    color: var(--dark);
    line-height: 1.6;
    letter-spacing: 0.3px;
}

/* Header */
header {
    background: linear-gradient(135deg, #0066CC 0%, #00A8E8 50%, #00D4FF 100%);
    color: white;
    padding: 30px 20px;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

header h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

header p {
    font-size: 15px;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Navigation */
nav {
    background: white;
    border-bottom: 2px solid #E8EEF5;
    padding: 0;
    display: flex;
    overflow-x: auto;
    gap: 0;
    flex-wrap: nowrap;
    box-shadow: 0 2px 4px rgba(13, 17, 23, 0.04);
}

nav a {
    flex: 0 1 auto;
    min-width: auto;
    padding: 14px 12px;
    text-decoration: none;
    color: #5A6C7D;
    border-bottom: 3px solid transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    position: relative;
}

nav a:last-child {
    order: 999 !important;
    margin-left: auto !important;
}

nav a:hover {
    background: linear-gradient(180deg, rgba(0, 102, 204, 0.05) 0%, rgba(0, 168, 232, 0.05) 100%);
    color: var(--primary);
}

nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: linear-gradient(180deg, rgba(0, 102, 204, 0.08) 0%, rgba(0, 168, 232, 0.04) 100%);
    font-weight: 700;
}

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

/* Cards */
.card {
    background: white;
    padding: 30px;
    margin-bottom: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid #E8EEF5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary-light));
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: #D0D7DE;
}

.card:hover::before {
    opacity: 1;
}

.card h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--dark);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border: none;
    padding-bottom: 0;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.card h3 {
    font-size: 17px;
    margin: 20px 0 12px 0;
    color: var(--dark);
    font-weight: 700;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.grid-item {
    padding: 20px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFB 100%);
    border-radius: 10px;
    border: 2px solid #E8EEF5;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.grid-item::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(0, 102, 204, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: all 0.3s;
}

.grid-item:hover {
    background: linear-gradient(135deg, #F0F6FF 0%, #E8F3FF 100%);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 102, 204, 0.1);
}

.grid-item:hover::before {
    opacity: 1;
}

.grid-item h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.grid-item p {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    border: 1px solid #E8EEF5;
    border-radius: 10px;
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, #F0F6FF 0%, #E8F3FF 100%);
    border-bottom: 2px solid #D0D7DE;
}

th {
    padding: 14px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid #D0D7DE;
    font-size: 13px;
    color: var(--dark);
    letter-spacing: 0.2px;
}

td {
    padding: 14px;
    border-bottom: 1px solid #E8EEF5;
    font-size: 13px;
    color: #5A6C7D;
}

tbody tr {
    transition: all 0.2s;
}

tbody tr:hover {
    background: linear-gradient(90deg, rgba(0, 102, 204, 0.03) 0%, rgba(0, 168, 232, 0.03) 100%);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #E8F0FF 0%, #F0F6FF 100%);
    color: #0066CC;
    border: 1px solid rgba(0, 102, 204, 0.2);
    letter-spacing: 0.2px;
}

.badge.success {
    background: linear-gradient(135deg, #E8F5F0 0%, #F0FAF8 100%);
    color: #00AA55;
    border-color: rgba(0, 170, 85, 0.2);
}

.badge.warning {
    background: linear-gradient(135deg, #FFF5E8 0%, #FFFAF0 100%);
    color: #FF9900;
    border-color: rgba(255, 153, 0, 0.2);
}

.badge.danger {
    background: linear-gradient(135deg, #FFE8E8 0%, #FFF0F0 100%);
    color: #FF3333;
    border-color: rgba(255, 51, 51, 0.2);
}

/* Form */
input, textarea, select {
    padding: 12px 14px;
    border: 2px solid #E8EEF5;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #FFFFFF;
    transition: all 0.25s;
    color: var(--dark);
}

input::placeholder, textarea::placeholder {
    color: #8B95A5;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: #F0F6FF;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1), 0 4px 12px rgba(0, 102, 204, 0.15);
}

/* Button */
button, .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    display: inline-block;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.2px;
}

button::before, .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before, .btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #0066CC 0%, #0088FF 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0052A3 0%, #0066CC 100%);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #00AA55 0%, #00DD66 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 170, 85, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #008844 0%, #00AA55 100%);
    box-shadow: 0 6px 16px rgba(0, 170, 85, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #00A8E8 0%, #00D4FF 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #0088CC 0%, #00A8E8 100%);
    box-shadow: 0 6px 16px rgba(0, 168, 232, 0.4);
    transform: translateY(-2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--primary);
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: var(--dark);
}

/* Progress Bar */
.progress {
    background: linear-gradient(90deg, #E8EEF5 0%, #F0F6FF 100%);
    border-radius: 10px;
    height: 28px;
    overflow: hidden;
    margin: 12px 0;
    border: 1px solid #E8EEF5;
    box-shadow: inset 0 2px 4px rgba(13, 17, 23, 0.04);
}

.progress-bar {
    background: linear-gradient(90deg, #0066CC 0%, #0088FF 100%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

/* Alert */
.alert {
    padding: 16px 18px;
    margin: 16px 0;
    border-radius: 10px;
    border-left: 4px solid;
    border: 1px solid;
    background-clip: padding-box;
    box-shadow: 0 2px 8px rgba(13, 17, 23, 0.08);
}

.alert-info {
    background: linear-gradient(135deg, #E8F5FF 0%, #F0F9FF 100%);
    border-color: #0066CC;
    color: #003399;
}

.alert-success {
    background: linear-gradient(135deg, #E8F5F0 0%, #F0FAF8 100%);
    border-color: #00AA55;
    color: #006633;
}

.alert-warning {
    background: linear-gradient(135deg, #FFF5E8 0%, #FFFAF0 100%);
    border-color: #FF9900;
    color: #996600;
}

.alert-danger {
    background: linear-gradient(135deg, #FFE8E8 0%, #FFF0F0 100%);
    border-color: #FF3333;
    color: #990000;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 22px;
    }

    nav a {
        min-width: auto;
        padding: 10px 8px;
        font-size: 11px;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }

    .image-comparison-grid {
        grid-template-columns: 1fr;
    }

    .image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* Footer */
footer {
    background: linear-gradient(135deg, #0D1117 0%, #1A1F2E 50%, #0D1117 100%);
    color: #C5D3E0;
    padding: 50px 20px;
    margin-top: 60px;
    border-top: 3px solid;
    border-image: linear-gradient(90deg, #0066CC, #00A8E8, #00D4FF) 1;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 102, 204, 0.5), transparent);
    pointer-events: none;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: white;
    font-size: 14px;
    margin-bottom: 15px;
    font-weight: 700;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section li {
    padding: 6px 0;
    font-size: 13px;
}

.footer-section a {
    color: #93c5fd;
    text-decoration: none;
    transition: all 0.3s;
}

.footer-section a:hover {
    color: white;
    padding-left: 5px;
}

.footer-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-stat-item {
    text-align: center;
    padding: 10px 0;
}

.footer-stat-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.footer-stat-label {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 5px;
}

.footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    font-size: 12px;
}

.footer-bottom p {
    margin: 5px 0;
}

.footer-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    margin-right: 8px;
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-stats {
        justify-content: center;
    }
}

/* AI Chatbot Floating Button & Modal */
.ai-chat-floating {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 999;
    transition: all 0.3s ease;
    border: none;
    color: white;
}

.ai-chat-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-chat-floating.active {
    background: var(--danger);
}

.ai-chat-modal {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 998;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-modal.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.ai-chat-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}

.ai-chat-close:hover {
    transform: rotate(90deg);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-chat-message {
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.ai-chat-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.ai-chat-message.assistant {
    align-self: flex-start;
    background: #f0f0f0;
    color: var(--dark);
}

.ai-chat-message.error {
    align-self: flex-start;
    background: #fee2e2;
    color: var(--danger);
}

.ai-chat-loading {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
}

.ai-chat-loading span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.ai-chat-loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-loading span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.ai-chat-input-box {
    border-top: 1px solid var(--border);
    padding: 12px;
    display: flex;
    gap: 8px;
}

.ai-chat-input-box input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.ai-chat-input-box button {
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.ai-chat-input-box button:hover {
    background: #0284c7;
}

.ai-chat-input-box button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* 리소스 모달 */
.resource-modal {
    display: none !important;
}

.resource-modal.show {
    display: flex !important;
}

.resource-modal-content {
    animation: slideUp 0.3s ease;
}

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

@media (max-width: 768px) {
    .ai-chat-floating {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .ai-chat-modal {
        bottom: 80px;
        right: 20px;
        width: calc(100% - 40px);
        max-width: 360px;
        height: 500px;
    }

    .resource-modal-content {
        width: 95% !important;
        padding: 20px !important;
    }
}
