/* SUITE 폰트 가져오기 - 7가지 굵기 */
@font-face {
    font-family: 'SUITE';
    font-weight: 100;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/sunn/SUIT-Thin.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'SUITE';
    font-weight: 200;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/sunn/SUIT-ExtraLight.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'SUITE';
    font-weight: 300;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/sunn/SUIT-Light.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'SUITE';
    font-weight: 400;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/sunn/SUIT-Regular.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'SUITE';
    font-weight: 500;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/sunn/SUIT-Medium.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'SUITE';
    font-weight: 600;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/sunn/SUIT-SemiBold.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'SUITE';
    font-weight: 700;
    font-style: normal;
    src: url('https://cdn.jsdelivr.net/gh/webfontworld/sunn/SUIT-Bold.woff2') format('woff2');
    font-display: swap;
}

/* Reset 및 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SUITE', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-weight: 100; /* Thin 굵기 사용 */
    line-height: 1.6;
    color: #8B7355;
    background: #F5E6D3;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* 메인 화면 */
.main-screen {
    width: 100%;
    max-width: 800px;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-content {
    display: flex;
    align-items: center;
    gap: 4rem;
    width: 100%;
    justify-content: center;
}

.create-section, .join-section {
    text-align: center;
    flex: 1;
    max-width: 300px;
}

.create-section {
    cursor: pointer;
    padding: 1.3rem 2rem 2.25rem 2rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.create-section:hover {
    background: rgba(139, 115, 85, 0.1);
    transform: translateY(-5px);
}

.create-section h2, .join-section h2 {
    font-size: 3rem;
    font-weight: 100; /* Thin 굵기 사용 */
    margin-bottom: 0.5rem;
    color: #8B7355;
}

.create-section p {
    font-size: 1.2rem;
    font-weight: 100; /* Thin 굵기 사용 */
    color: #A0926B;
}

.join-input-container {
    display: flex;
    align-items: center;
    max-width: 300px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #D4C4A8;
    border-radius: 30px;
    overflow: hidden;
    transition: all 0.3s ease;
    padding: 0;
    position: relative; /* 추가 */
}

.join-input-container:focus-within {
    border-color: #8B7355;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 15px rgba(139, 115, 85, 0.2);
}

#clipboardCodeInput {
    flex: 1;
    padding: 1rem 1.5rem;
    padding-right: 60px; /* 버튼 공간 확보 - 추가 */
    border: none;
    background: transparent;
    font-family: 'SUITE', sans-serif;
    font-weight: 100;
    font-size: 1rem;
    text-align: center;
    color: #8B7355;
    outline: none;
}

.divider {
    width: 1px;
    height: 200px;
    background: #D4C4A8;
    margin: 0 2rem;
}

#clipboardCodeInput::placeholder {
    color: #B8A082;
    font-style: italic;
}

.join-btn {
    position: absolute; /* 변경: 기존 relative */
    right: 2px; /* 추가 */
    top: 2px; /* 추가 */
    bottom: 2px; /* 추가 */
    width: auto; /* 변경: 기존 50px */
    min-width: 48px; /* 추가 */
    height: auto; /* 변경: 기존 50px */
    border: none;
    background: #8B7355;
    color: #F5E6D3;
    font-size: 1.5rem;
    font-weight: 100;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 26px 26px 0; /* 변경: 기존 0 25px 25px 0 */
    margin: 0; /* 변경: 기존 3px 3px 3px 0 */
    padding: 0 1rem; /* 추가 */
}

.join-btn:hover {
    background: #7A6B4F;
    transform: scale(1.05);
}

/* 클립보드 화면 */
.clipboard-screen {
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(139, 115, 85, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.clipboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #E8DCC6;
    background: rgba(255, 255, 255, 0.5);
}

.clipboard-header h3 {
    font-size: 1.3rem;
    font-weight: 300; /* Light 굵기 사용 */
    color: #8B7355;
}

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

.header-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(139, 115, 85, 0.1);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.header-btn:hover {
    background: rgba(139, 115, 85, 0.2);
    transform: translateY(-2px);
}

/* 콘텐츠 그리드 */
.content-grid {
    flex: 1;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    grid-auto-rows: 180px;
    gap: 2.5rem; /* 변경: 1.5rem → 2.5rem */
    overflow-y: auto;
    align-content: start;
    align-items: start;
    justify-content: start;
}

.add-item {
    aspect-ratio: 1;
    border: 2px dashed #D4C4A8;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.3);
}

.add-item:hover {
    border-color: #8B7355;
    background: rgba(139, 115, 85, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(139, 115, 85, 0.15);
}

.add-icon {
    font-size: 3rem;
    color: #8B7355;
    font-weight: 100; /* Thin 굵기 사용 */
}

/* 콘텐츠 아이템 */
.content-item {
    aspect-ratio: 1;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 115, 85, 0.2);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.content-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(139, 115, 85, 0.2);
    border-color: #8B7355;
}

.content-item.text-item {
    justify-content: center;
    text-align: center;
}

.content-item.file-item {
    justify-content: space-between;
}

.content-item.image-item {
    padding: 0;
    overflow: hidden;
}

/* 텍스트 아이템 */
.text-content {
    font-family: 'SUITE', sans-serif;
    font-weight: 200; /* ExtraLight 굵기 사용 */
    font-size: 0.9rem;
    color: #8B7355;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
}

/* 파일 아이템 */
.file-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: auto;
}

.file-info {
    text-align: center;
}

.file-name {
    font-family: 'SUITE', sans-serif;
    font-weight: 300; /* Light 굵기 사용 */
    font-size: 0.8rem;
    color: #8B7355;
    margin-bottom: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-family: 'SUITE', sans-serif;
    font-weight: 100; /* Thin 굵기 사용 */
    font-size: 0.7rem;
    color: #A0926B;
}

/* 이미지 아이템 */
.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 1rem;
    font-family: 'SUITE', sans-serif;
    font-weight: 200; /* ExtraLight 굵기 사용 */
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.content-item.image-item:hover .image-overlay {
    opacity: 1;
}

/* 상태바 */
.status-bar {
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid #E8DCC6;
    font-family: 'SUITE', sans-serif;
    font-weight: 200; /* ExtraLight 굵기 사용 */
    font-size: 0.9rem;
    color: #A0926B;
    text-align: center;
}

/* 로딩 오버레이 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(245, 230, 211, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: #8B7355;
    backdrop-filter: blur(5px);
}

.loading-overlay p {
    font-family: 'SUITE', sans-serif;
    font-weight: 200; /* ExtraLight 굵기 사용 */
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(139, 115, 85, 0.3);
    border-top: 3px solid #8B7355;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    
    /* 핵심: 너비 제한으로 화면 밖으로 나가지 않게 */
    max-width: min(350px, calc(100vw - 4rem)); /* 화면 너비 - 좌우 여백 */
    
    /* 긴 텍스트 처리 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    
    /* 기존 스타일 유지 */
    background: #8B7355;
    color: #F5E6D3;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(139, 115, 85, 0.3);
    backdrop-filter: blur(10px);
    font-family: 'SUITE', sans-serif;
    font-weight: 300; /* Light 굵기 사용 */
    z-index: 1001;
    
    /* 변경: transform 대신 opacity 사용 */
    opacity: 0;
    visibility: hidden; /* 완전히 숨김 */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toast.show {
    opacity: 1;
    visibility: visible; /* 보이게 */
}

.toast.success {
    background: #7A9B57;
}

.toast.error {
    background: #C4704F;
}

/* 파일 타입별 아이콘 색상 */
.file-item[data-type*="image"] .file-icon { color: #FF6B6B; }
.file-item[data-type*="pdf"] .file-icon { color: #FF4757; }
.file-item[data-type*="text"] .file-icon { color: #3742FA; }
.file-item[data-type*="zip"] .file-icon { color: #FFA502; }
.file-item[data-type*="video"] .file-icon { color: #FF3838; }
.file-item[data-type*="audio"] .file-icon { color: #1DD1A1; }

/* 빈 상태 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #A0926B;
    font-family: 'SUITE', sans-serif;
    font-weight: 200; /* ExtraLight 굵기 사용 */
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .main-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .divider {
        width: 200px;
        height: 1px;
        margin: 1rem 0;
    }
    
    .clipboard-screen {
        height: 85vh;
    }
    
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }
    
    .clipboard-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .create-section h2, .join-section h2 {
        font-size: 2rem;
    }
    
    .create-btn {
        width: 60px;
        height: 60px;
    }
}