/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* 시작 애니메이션 */
.startup-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 1s ease-out, visibility 1s ease-out;
}

.startup-animation.hide {
    opacity: 0;
    visibility: hidden;
}

.animation-content {
    text-align: center;
    color: white;
}

.studix-logo {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: 0.1em;
}

.studix-logo .letter {
    display: inline-block;
    animation: bounceIn 0.6s ease;
    animation-fill-mode: both;
}

.studix-logo .letter:nth-child(1) { animation-delay: 0.1s; }
.studix-logo .letter:nth-child(2) { animation-delay: 0.2s; }
.studix-logo .letter:nth-child(3) { animation-delay: 0.3s; }
.studix-logo .letter:nth-child(4) { animation-delay: 0.4s; }
.studix-logo .letter:nth-child(5) { animation-delay: 0.5s; }
.studix-logo .letter:nth-child(6) { animation-delay: 0.6s; }

.loading-text {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1s forwards;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
    opacity: 0;
    animation: fadeInUp 0.8s ease 1.2s forwards;
}

.loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ffffff, #f0f0f0);
    border-radius: 2px;
    animation: loadingProgress 2s ease 1.4s forwards;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-50px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

@keyframes loadingProgress {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 헤더 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

/* 버튼 스타일 */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-view {
    background: #f8f9fa;
    color: #666;
}

.btn-view.active {
    background: #667eea;
    color: white;
}

.btn-view:hover {
    background: #5a67d8;
    color: white;
}

.btn-nav {
    background: #f8f9fa;
    color: #666;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.btn-nav:hover {
    background: #667eea;
    color: white;
}

.btn-today {
    background: #4ade80;
    color: white;
}

.btn-today:hover {
    background: #22c55e;
}

.btn-send {
    background: #667eea;
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.btn-send:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* 메인 콘텐츠 */
.main-content {
    flex: 1;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    gap: 1rem;
    padding: 1rem;
}

/* 사이드바 */
.sidebar {
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.sidebar h3 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar h3 i {
    color: #667eea;
}

.sidebar h3 {
    position: relative;
}

.btn-ai-settings {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.btn-ai-settings:hover {
    color: #667eea;
    background: #f3f4f6;
}

/* 챗봇 섹션 */
.chatbot-section {
    margin-bottom: 2rem;
}

.chat-container {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.chat-messages {
    height: 200px;
    overflow-y: auto;
    padding: 1rem;
    background: #f9fafb;
}

.chat-message {
    margin-bottom: 1rem;
}

.chat-message.bot .message-content {
    background: #667eea;
    color: white;
    padding: 0.75rem;
    border-radius: 12px 12px 12px 4px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-message.user .message-content {
    background: #f3f4f6;
    color: #374151;
    padding: 0.75rem;
    border-radius: 12px 12px 4px 12px;
    margin-left: 2rem;
    font-size: 0.9rem;
}

.chat-input-container {
    display: flex;
    padding: 0.75rem;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.5rem;
    font-size: 0.9rem;
    font-family: inherit;
}

/* 파일 드롭 존 */
.file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: #667eea;
    background: #f8faff;
}

.drop-zone-content i {
    font-size: 2rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.drop-zone-content p {
    margin: 0.25rem 0;
    color: #6b7280;
}

.drop-zone-subtitle {
    font-size: 0.8rem !important;
    color: #9ca3af !important;
}

/* 일정 목록 */
.schedule-list, .upcoming-events {
    margin-bottom: 2rem;
}

.today-schedule, .upcoming-list {
    max-height: 150px;
    overflow-y: auto;
}

.schedule-item {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 4px solid #667eea;
    position: relative;
}

.schedule-item.assignment {
    border-left-color: #f59e0b;
}

.schedule-item.exam {
    border-left-color: #ef4444;
}

.schedule-item.class {
    border-left-color: #10b981;
}

.schedule-item.priority-high {
    border-left-width: 6px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.schedule-item.priority-medium {
    border-left-width: 5px;
}

.schedule-item.priority-low {
    border-left-width: 4px;
    opacity: 0.8;
}

.schedule-time {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.schedule-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-type {
    font-size: 0.8rem;
    color: #667eea;
    text-transform: uppercase;
}

.priority-badge {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-weight: 600;
}

.priority-badge.medium {
    background: #f59e0b;
}

.priority-badge.low {
    background: #10b981;
}

.countdown-timer {
    font-size: 0.7rem;
    color: #ef4444;
    font-weight: 600;
    margin-top: 0.25rem;
    padding: 0.2rem 0.4rem;
    background: #fee2e2;
    border-radius: 4px;
    text-align: center;
}

.countdown-timer.warning {
    background: #fef3c7;
    color: #f59e0b;
}

.countdown-timer.safe {
    background: #d1fae5;
    color: #10b981;
}

.countdown-timer.urgent {
    background: #fee2e2;
    color: #ef4444;
    font-weight: 700;
    animation: pulse 2s infinite;
}

.countdown-timer.expired {
    background: #f3f4f6;
    color: #6b7280;
    text-decoration: line-through;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* 팝업 스케줄 스타일 */
.popup-schedule-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.popup-schedule-item.assignment {
    border-left-color: #f59e0b;
}

.popup-schedule-item.exam {
    border-left-color: #ef4444;
}

.popup-schedule-item.class {
    border-left-color: #10b981;
}

.popup-schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.popup-schedule-time {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.popup-schedule-details {
    font-size: 0.85rem;
    color: #374151;
    white-space: pre-line;
    line-height: 1.4;
}

.no-schedule {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* 캘린더 섹션 */
.calendar-section {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

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

.current-date {
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
    min-width: 200px;
    text-align: center;
}

/* 캘린더 뷰 */
.calendar-view > div {
    display: none;
}

.calendar-view > div.active {
    display: block;
}

/* 월간 뷰 */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 1px;
}

.weekday {
    background: #f3f4f6;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #4b5563;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
}

.day-cell {
    background: white;
    min-height: 120px;
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.day-cell:hover {
    background: #f9fafb;
}

.day-cell.other-month {
    background: #f8f9fa;
    color: #9ca3af;
}

.day-cell.today {
    background: #eff6ff;
    border: 2px solid #3b82f6;
}

.day-cell.has-events {
    background: #fef3c7;
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.day-events {
    font-size: 0.7rem;
}

.event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    display: inline-block;
    margin-right: 0.25rem;
}

.event-dot.assignment {
    background: #f59e0b;
}

.event-dot.exam {
    background: #ef4444;
}

.event-dot.class {
    background: #10b981;
}

/* 주간 뷰 */
.week-header {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 1px;
}

.week-header-cell {
    background: #f3f4f6;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #4b5563;
}

.week-content {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    max-height: 600px;
    overflow-y: auto;
}

.time-slot {
    background: #f9fafb;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    border-right: 2px solid #e5e7eb;
}

.week-day-column {
    background: white;
    position: relative;
    min-height: 60px;
}

/* 일간 뷰 */
.day-header {
    text-align: center;
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.day-content {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1px;
    background: #e5e7eb;
    max-height: 600px;
    overflow-y: auto;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    color: #374151;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.event-details {
    line-height: 1.6;
}

.event-details h4 {
    color: #374151;
    margin-bottom: 0.5rem;
}

.event-details p {
    color: #6b7280;
    margin-bottom: 1rem;
}

/* 토스트 알림 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .calendar-section {
        order: 1;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .day-cell {
        min-height: 80px;
        font-size: 0.8rem;
    }
    
    .current-date {
        font-size: 1.2rem;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.schedule-item {
    animation: fadeIn 0.3s ease;
}

/* 이벤트 타입별 색상 */
.event-assignment {
    background: #fef3c7;
    border-left-color: #f59e0b;
}

.event-exam {
    background: #fee2e2;
    border-left-color: #ef4444;
}

.event-class {
    background: #d1fae5;
    border-left-color: #10b981;
}

.event-meeting {
    background: #e0e7ff;
    border-left-color: #6366f1;
}

/* AI 설정 스타일 */
.ai-settings {
    max-height: 500px;
    overflow-y: auto;
}

.setting-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item h4 {
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.setting-description {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.current-key {
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.current-key code {
    background: #e5e7eb;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #374151;
}

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

.analysis-mode {
    margin: 1rem 0;
}

.analysis-mode label {
    display: block;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.analysis-mode input[type="radio"] {
    margin-right: 0.5rem;
}

.usage-stats {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.usage-stats div {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #374151;
}

.usage-stats div:last-child {
    margin-bottom: 0;
    font-weight: 600;
}
