:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* 네비게이션 */
.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: 0.5px;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.3s;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #fff;
}

/* 카드 스타일 */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    background-color: #fff;
    border-bottom: 2px solid #f0f0f0;
    font-weight: 600;
}

/* 프로젝트 카드 */
.project-card {
    cursor: pointer;
    height: 100%;
}

.project-card .card-body {
    padding: 1.5rem;
}

.project-code {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e9ecef;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
}

.project-status {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.status-active {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-completed {
    background-color: #cfe2ff;
    color: #084298;
}

.status-archived {
    background-color: #e2e3e5;
    color: #41464b;
}

/* 카테고리 배지 */
.category-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.category-hardware {
    background-color: #fff3cd;
    color: #997404;
}

.category-software {
    background-color: #d1ecf1;
    color: #0c5460;
}

.category-mixed {
    background-color: #f8d7da;
    color: #842029;
}

/* 버전 배지 */
.version-badge {
    background-color: #0d6efd;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.version-latest {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 태그 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    background-color: #e7f3ff;
    color: #0066cc;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

/* 버튼 스타일 */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63408b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* 파일 아이템 */
.file-item {
    padding: 1rem;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.file-item:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.file-icon {
    width: 40px;
    height: 40px;
    background-color: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* 드래그 앤 드롭 영역 */
.dropzone {
    border: 3px dashed #dee2e6;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background-color: #fff;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #0d6efd;
    background-color: #f0f7ff;
}

.dropzone i {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* 페이지 헤더 */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.page-header h1 {
    font-weight: 700;
    color: #212529;
}

/* 통계 카드 */
.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 로딩 스피너 */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* 반응형 */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

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

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    border: none;
}

.hero-title {
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 3.5rem;
}

.hero-subtitle {
    color: #ffffff;
    opacity: 0.95;
    font-size: 1.3rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.hero-section .btn {
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.hero-section .btn-light:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.hero-section .btn-outline-light {
    border-width: 2px;
}

.hero-section .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 반응형 - 태블릿 */
@media (max-width: 992px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-section .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 2rem;
    }
}

/* 반응형 - 모바일 */
@media (max-width: 768px) {
    .hero-section .card-body {
        padding: 2.5rem 1.5rem !important;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-subtitle br {
        display: none;
    }
    
    .hero-section .btn-lg {
        font-size: 0.95rem;
        padding: 0.65rem 1.5rem;
        display: block;
        width: 100%;
        margin: 0.5rem 0 !important;
    }
}

/* 반응형 - 작은 모바일 */
@media (max-width: 576px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .hero-section .btn-lg {
        font-size: 0.9rem;
        padding: 0.6rem 1.25rem;
    }
}

/* Hero 버튼 컨테이너 */
.hero-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 100%;
    }
}

/* 코드 블록 스타일 */
pre {
    background-color: #2d2d2d;
    color: #abb2bf;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

pre code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    display: block;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

pre code {
    background-color: transparent;
    padding: 0;
}

/* 카테고리별 색상 */
.category-hardware {
    color: #ffc107;
}

.category-software {
    color: #0dcaf0;
}

.category-mixed {
    color: #dc3545;
}

.category-information {
    color: #198754;
}

/* 카테고리 배지 호버 효과 */
.badge.bg-warning:hover {
    background-color: #e0a800 !important;
}

.badge.bg-info:hover {
    background-color: #0bb4d6 !important;
}

.badge.bg-danger:hover {
    background-color: #bb2d3b !important;
}

.badge.bg-success:hover {
    background-color: #157347 !important;
}

/* 폼 유효성 검사 피드백 */
.form-control.is-valid {
    border-color: #198754;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(.375em + .1875rem) center;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem);
}

.form-control.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(.375em + .1875rem) center;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem);
}

#code-feedback {
    min-height: 24px;
}

/* 마크다운 컨텐츠 스타일 */
.markdown-content {
    line-height: 1.8;
    color: #333;
}

.markdown-content h1 {
    font-size: 2rem;
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.markdown-content h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e9ecef;
}

.markdown-content h3 {
    font-size: 1.25rem;
    font-weight: bold;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

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

.markdown-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d63384;
}

.markdown-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

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

.markdown-content a {
    color: #0d6efd;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content strong {
    font-weight: bold;
}

.markdown-content em {
    font-style: italic;
}

/* 다크모드 마크다운 */
[data-theme="dark"] .markdown-content {
    color: #e9ecef;
}

[data-theme="dark"] .markdown-content h1,
[data-theme="dark"] .markdown-content h2 {
    border-bottom-color: #495057;
}

[data-theme="dark"] .markdown-content code {
    background-color: rgba(255, 255, 255, 0.1);
    color: #98c379;
}

/* 알림 드롭다운 */
.notification-dropdown {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.notification-dropdown .dropdown-item {
    padding: 0.75rem 1rem;
    border: none;
    transition: background-color 0.2s;
}

.notification-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

.notification-dropdown .dropdown-item.bg-light {
    background-color: #e3f2fd !important;
}

.notification-dropdown .dropdown-item.bg-light:hover {
    background-color: #bbdefb !important;
}

/* 알림 배지 애니메이션 */
#notification-badge {
    font-size: 0.6rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* 다크모드 알림 */
[data-theme="dark"] .notification-dropdown {
    background-color: #2d3748;
    border-color: #4a5568;
}

[data-theme="dark"] .notification-dropdown .dropdown-item {
    color: #e2e8f0;
}

[data-theme="dark"] .notification-dropdown .dropdown-item:hover {
    background-color: #4a5568;
}

[data-theme="dark"] .notification-dropdown .dropdown-item.bg-light {
    background-color: rgba(66, 153, 225, 0.2) !important;
}

/* 프로젝트 상세 페이지 반응형 개선 */
@media (max-width: 991.98px) {
    #project-header .card-body h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    #project-header .card-body h2 {
        font-size: 1.25rem;
    }
    
    #project-header .project-code {
        font-size: 0.875rem;
    }
    
    #project-header .row.text-muted {
        font-size: 0.75rem;
    }
}

/* 모바일 드롭다운 */
.dropdown-menu {
    max-height: 70vh;
    overflow-y: auto;
}

.dropdown-header {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.875rem;
}

/* 다크모드 드롭다운 */
[data-theme="dark"] .dropdown-menu {
    background-color: #2d3748;
    border-color: #4a5568;
}

[data-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: #4a5568;
    color: #fff;
}

[data-theme="dark"] .dropdown-header {
    color: #a0aec0;
}

[data-theme="dark"] .dropdown-divider {
    border-color: #4a5568;
}

/* ==================== 프로젝트 목록 페이지 반응형 ==================== */

/* 페이지 헤더 */
.page-header h1 {
    white-space: nowrap;
    font-size: 2rem;
}

.page-header h1 i {
    font-size: 1.8rem;
}

/* 버튼 간격 */
.gap-2 {
    gap: 0.5rem !important;
}

/* 태블릿 (768px ~ 991px) */
@media (max-width: 991.98px) {
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    .page-header h1 i {
        font-size: 1.5rem;
    }
}

/* 중간 모바일 (576px ~ 767px) */
@media (max-width: 767.98px) {
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-header h1 i {
        font-size: 1.3rem;
    }
    
    /* 버튼 크기 조정 */
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }
}

/* 작은 모바일 (≤575px) */
@media (max-width: 575.98px) {
    .page-header {
        margin-bottom: 1rem !important;
    }
    
    .page-header h1 {
        font-size: 1.3rem;
    }
    
    .page-header h1 i {
        font-size: 1.1rem;
    }
    
    /* 작은 버튼 */
    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
    
    .btn-sm i {
        font-size: 1rem;
    }
}

/* 매우 작은 화면 (≤400px) */
@media (max-width: 400px) {
    .page-header h1 {
        font-size: 1.15rem;
    }
    
    .page-header h1 i {
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* 필터 카드 모바일 최적화 */
@media (max-width: 767.98px) {
    .card-body .row .col-md-4,
    .card-body .row .col-md-3,
    .card-body .row .col-md-2 {
        margin-bottom: 0.5rem;
    }
}

/* ==================== 프로젝트 폼 반응형 ==================== */

/* 폼 버튼 간격 */
.gap-2 {
    gap: 0.5rem !important;
}

/* 데스크톱 */
@media (min-width: 576px) {
    /* 버튼 자동 너비 */
    .w-sm-auto {
        width: auto !important;
        min-width: 120px;
    }
    
    /* 버튼 순서 */
    .order-sm-1 {
        order: 1 !important;
    }
    
    .order-sm-2 {
        order: 2 !important;
    }
    
    /* 생성 버튼 좌우 패딩 */
    .px-sm-5 {
        padding-left: 3rem !important;
        padding-right: 3rem !important;
    }
}

/* 모바일 */
@media (max-width: 575.98px) {
    /* 페이지 헤더 */
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    /* 폼 레이블 */
    .form-label {
        font-size: 0.95rem;
    }
    
    /* 버튼 전체 너비 */
    .w-100 {
        width: 100% !important;
    }
    
    /* 버튼 순서: 생성 위, 취소 아래 */
    .order-1 {
        order: 1 !important;
        margin-bottom: 0;
    }
    
    .order-2 {
        order: 2 !important;
        margin-top: 0;
    }
    
    /* 버튼 크기 조정 */
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* 큰 입력 필드 크기 조정 */
    .form-control-lg,
    .form-select-lg {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    /* 카드 패딩 줄이기 */
    .card-body.p-4 {
        padding: 1.5rem !important;
    }
}

/* 매우 작은 화면 */
@media (max-width: 400px) {
    .page-header h1 {
        font-size: 1.3rem;
    }
    
    .btn-lg {
        padding: 0.65rem 0.9rem;
        font-size: 0.95rem;
    }
    
    .card-body.p-4 {
        padding: 1rem !important;
    }
}

/* 태그 프리뷰 */
#tags-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#tags-preview .tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e9ecef;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

[data-theme="dark"] #tags-preview .tag {
    background-color: #4a5568;
    color: #e2e8f0;
}
/* ==================== 에러 모달 스타일 ==================== */

/* 로그인 필요 모달 */
#loginRequiredModal .modal-content,
#errorModal .modal-content {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

#loginRequiredModal .modal-body i,
#errorModal .modal-body i {
    animation: modalIconPulse 2s infinite;
}

@keyframes modalIconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* 모달 버튼 */
#loginRequiredModal .modal-footer .btn,
#errorModal .modal-footer .btn {
    min-width: 100px;
}

/* 다크모드 */
[data-theme="dark"] #loginRequiredModal .modal-content,
[data-theme="dark"] #errorModal .modal-content {
    background-color: #2d3748;
    color: #e2e8f0;
}

[data-theme="dark"] #loginRequiredModal .modal-body .text-muted,
[data-theme="dark"] #errorModal .modal-body .text-muted {
    color: #a0aec0 !important;
}

[data-theme="dark"] #loginRequiredModal .modal-footer,
[data-theme="dark"] #errorModal .modal-footer {
    border-color: #4a5568;
}

/* ==================== 버전 카드 모바일 반응형 ==================== */

/* 모바일 버전 카드 버튼 */
@media (max-width: 767.98px) {
    .version-card .btn-group {
        flex-shrink: 0;
    }
    
    .version-card .btn-sm {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .version-card .btn-sm i {
        margin: 0;
    }
}
/* ==================== 버전 상세 페이지 모바일 반응형 ==================== */

/* 파일 아이템 */
.file-item {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

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

.file-icon {
    font-size: 2rem;
    color: #6c757d;
}

/* 파일명 말줄임 */
.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 모바일 최적화 */
@media (max-width: 767.98px) {
    /* 버전 헤더 타이틀 */
    #version-header h2 {
        font-size: 1.5rem;
    }
    
    #version-header h4 {
        font-size: 1.25rem;
    }
    
    /* 버전 헤더 버튼 */
    #version-header .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }
    
    /* 파일 아이템 */
    .file-item {
        padding: 0.75rem;
    }
    
    .file-icon {
        font-size: 1.5rem;
    }
    
    /* 파일명 크기 조정 */
    .file-name {
        font-size: 0.95rem;
    }
    
    .file-info .small {
        font-size: 0.8rem;
    }
    
    /* 파일 버튼 */
    .file-item .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 575.98px) {
    /* 작은 모바일 */
    #version-header h2 {
        font-size: 1.3rem;
    }
    
    #version-header h4 {
        font-size: 1.1rem;
    }
    
    .file-name {
        font-size: 0.9rem;
        max-width: 200px;
    }
    
    .file-item .btn-sm {
        padding: 0.35rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* 간격 조정 */
.gap-2 {
    gap: 0.5rem !important;
}