/* 문서보관함 개인정보관리 스타일 */
.document-container {
    display: flex;
    gap: 10px;
    padding: 0px;
    background: #FFFFFF;
    min-height: 90vh;
}

.doc-form-section {
    flex: 1;
    background: #E3F2FD;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s;
    height: 550px;
    overflow-y: auto;
}
.doc-form-section.image {
    background: #E3F2FD;
}

.doc-form-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 500px;
    margin-left: 0;
}

.doc-type-select {
    padding: 5px;
    border-radius: 8px;
    border: 1.5px solid #FFD600;
    font-size: 16px;
    font-weight: bold;
    background: #FFFDE7;
    transition: background 0.3s, border 0.3s;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
}
.doc-form-section.image .doc-type-select {
    border-color: #2196F3;
    background: #E3F2FD;
}

.doc-title-input, .doc-file-input, .doc-desc-input {
    padding: 10px;
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    font-size: 15px;
}

.doc-desc-input {
    min-height: 60px;
    resize: vertical;
}

.doc-file-input {
    width: 150%;
    height: 40px !important;
    padding: 12px 10px 4px 10px;
    border-radius: 8px;
    border: 1px solid #2196F3;
    font-size: 15px;
    box-sizing: border-box;
}

.doc-file-input::-webkit-file-upload-button {
    height: 32px;
    margin: 0 10px 0 0;
    padding: 0 16px;
    border: none;
    border-radius: 4px;
    background: #2196F3;
    color: white;
    font-weight: bold;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
}

.custom-file-label {
    min-width: 90px;
    max-width: 90px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2196F3;
    color: #fff;
    border-radius: 4px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    margin: 0;
}

.custom-file-label span {
    pointer-events: none;
    font-size: 16px;
    line-height: 30px;
    display: inline-block;
}

.file-name {
    min-width: 0;
    max-width: 180px;
    width: 180px;
    height: 38px;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    color: #222;
    margin: 0 8px 0 0;
}

.register-btn {
    flex: none;
    padding: 0 13px;
    height: 30px;
    background: #43A047;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-left: 61px; /* 1px 왼쪽으로 조정 */
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.register-btn:hover {
    background: #388E3C;
}

.doc-details-input {
    width: 100%;
    height: 300px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #000;
    font-size: 15px;
    resize: none;
    margin-top: 20px;
}

.doc-list-section {
    flex: 1;
    background: #FFF0F5;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    height: 550px;
    overflow-y: auto;
}

.doc-list-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    justify-content: flex-start;
}

.search-with-reset {
    position: relative;
    display: flex;
    align-items: center;
}
.reset-search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 20px;
    color: #b44;
    cursor: pointer;
    padding: 0;
    height: 100%;
    line-height: 1;
}
.doc-search-input {
    flex: none;
    width: 180px;
    height: 42px !important;
    padding: 9px 12px;
    border-radius: 7px;
    border: 1.5px solid rgba(30,58,138,0.50) !important;
    box-shadow: inset 0 1.8px 0 rgba(255,255,255,0.98), 0 3px 8px rgba(17,24,39,0.12);
    font-size: 15px;
    box-sizing: border-box;
    background: #ffffff !important;
    margin-left: 27px;
    display: flex;
    align-items: center;
}

.doc-type-dropdown {
    width: 150px;
    height: 42px !important;
    border: 1.5px solid rgba(30,58,138,0.50) !important;
    box-shadow: inset 0 1.8px 0 rgba(255,255,255,0.98), 0 3px 8px rgba(17,24,39,0.12);
    border-radius: 7px;
    font-size: 15px;
    padding: 10px 12px !important;
    box-sizing: border-box;
    background: #ffffff !important;
    color: #333;
    font-weight: bold;
    display: flex;
    align-items: center;
    margin-left: 12px !important; /* 불필요한 큰 마진 제거 */
    line-height: 1.3;
}

.doc-filter-buttons {
    display: flex;
    gap: 10px;
}

.doc-filter-btn {
    padding: 8px 12px;
    height: 30px;
    border: 1px solid brown;
    border-radius: 6px;
    background: #E3F2FD;
    color: #1976D2;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-filter-btn:hover {
    background: #BBDEFB;
}

.doc-filter-btn.active {
    background: #1976D2;
    color: white;
}

.doc-type-filter {
    padding: 9px 12px;
    border-radius: 7px;
    border: 1.5px solid #FFD600;
    font-size: 15px;
    background: #FFFDE7;
    font-weight: bold;
}

.doc-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.doc-item {
    min-height: 44px;
    max-height: 44px;
    display: flex;
    align-items: center;
    /* 배경/테두리/모서리 */
    background: linear-gradient(180deg, #ffffff 0%, #eef4ff 55%, #e6f0ff 56%, #f3f7ff 100%);
    border: 1.5px solid rgba(30,58,138,0.40);
    border-radius: 8px;
    /* 입체감(그림자) */
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.98), 0 3px 10px rgba(17,24,39,0.14);
    padding: 5px 12px;
    gap: 10px;
    cursor: pointer;
    /* 전환/애니메이션 */
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}
.doc-item:hover {
    /* Hover(마우스 올림) */
    background: linear-gradient(180deg, #ffffff 0%, #e3edff 50%, #cfe0ff 51%, #e9f2ff 100%);
    border-color: #2563eb;
    box-shadow: inset 0 2.2px 0 rgba(255,255,255,1), 0 10px 24px rgba(17,24,39,0.24);
    transform: translateY(-3px);
    filter: saturate(1.12);
}
.doc-item:active {
    /* Active(클릭/누름) */
    transform: translateY(0);
    background: linear-gradient(180deg, #f8fbff 0%, #e2ecff 60%, #dae6ff 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 2px 8px rgba(17,24,39,0.16);
    border-color: #1d4ed8;
}
.doc-item:focus-visible {
    /* Focus-visible(키보드 탐색) */
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25), inset 0 2px 0 rgba(255,255,255,1);
}
.doc-item .doc-icon {
    font-size: 28px;
}
.doc-item .doc-title {
    font-size: 15px;
    line-height: 1.2;
    max-height: 2.4em;
    font-weight: bold;
    margin-right: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
    max-width: 90%;
}
.doc-item .doc-desc {
    color: #666;
    font-size: 14px;
    margin-right: 8px;
}
.doc-item .doc-meta {
    color: #999;
    font-size: 12px;
    margin-left: auto;
}
.doc-item .delete-btn {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 0;
    margin-left: 10px;
    cursor: pointer;
    font-size: 13px;
    min-width: 48px;
    width: 48px;
    text-align: center;
    align-self: center;
}
.doc-item .delete-btn:hover {
    background: #d32f2f;
}
.doc-item .doc-details {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    border: 1px solid #eee;
}

/* 스크롤바 스타일링 */
.doc-form-section::-webkit-scrollbar,
.doc-list-section::-webkit-scrollbar {
    width: 8px;
}

.doc-form-section::-webkit-scrollbar-track,
.doc-list-section::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.doc-form-section::-webkit-scrollbar-thumb,
.doc-list-section::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.doc-form-section::-webkit-scrollbar-thumb:hover,
.doc-list-section::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.doc-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
    max-width: 90%;
    font-size: 15px;
    line-height: 1.2;
    max-height: 2.4em;
}

.main-vertical-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
    box-sizing: border-box;
    padding: 20px; /* 개인정보와 동일 여백 */
    overflow-x: hidden; /* 컨테이너 레벨에서도 가로 스크롤 방지 */
}

.top-section {
    width: 100%;
    height: 70px;
    background: #FFE0B2;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 24px;
}

.top-row {
    display: flex;
    align-items: center;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    width: 100%;
    gap: 12px;
}

.bottom-section {
    width: 100%;
    height: 550px;
    background: #E3F2FD;
    border-radius: 12px;
    box-sizing: border-box;
    padding: 24px 24px 0 24px;
    overflow-y: auto;
    overflow-x: hidden; /* 가로 스크롤 숨김 */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.doc-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* 화면 폭에 맞춰 자동 줄바꿈 */
    gap: 15px;
    width: 100%;
}

/* 모바일 반응형 - 파일명 및 버튼 크기 조정 */
@media (max-width: 768px) {
    .file-name {
        width: 250px !important;
        max-width: 250px !important;
        height: 30px !important;
        font-size: 13px !important;
    }
    
    .register-btn {
        margin-left: 20px !important;  /* 100px에서 20px로 줄임 */
    }
    
    .custom-file-label {
        min-width: 80px !important;  /* 90px에서 80px로 줄임 */
        max-width: 80px !important;
    }
} 

/* ===== 카드 가독성 개선 (모바일/데스크톱 공통 기본값) ===== */
.doc-item {
    /* 아이콘 | 콘텐츠(제목/메타) | 삭제 */
    display: grid;
    grid-template-columns: 28px 1fr 58px;
    grid-template-rows: auto auto;
    align-items: start;
    padding: 8px 12px 10px 10px;
    column-gap: 10px;
    row-gap: 2px; /* 제목-메타 간격 축소 */
}
.doc-item .doc-icon { font-size: 22px; margin-top: 2px; grid-column: 1; grid-row: 1 / span 2; }
.doc-item .doc-title {
    grid-column: 2; grid-row: 1;
    font-size: 14px; line-height: 1.3; text-align: left; /* 왼쪽 정렬 보장 */
    -webkit-line-clamp: 1;  /* 제목을 길게 보이고 싶으면 2로 변경 */
    max-height: 1.3em;      /* 2줄이면 2.6em */
}
.doc-item .delete-btn {
    grid-column: 3; grid-row: 1;
    position: static; right: auto; top: auto;
    min-width: 40px; width: auto; height: 26px;
    padding: 2px 8px; font-size: 12px; border-radius: 6px;
    justify-self: end; align-self: start;
}
.doc-item .doc-meta {
    grid-column: 2; grid-row: 2;
    display: flex; flex-wrap: wrap; gap: 6px;
    font-size: 11px; color: #6b7280; margin-top: 0; /* 간격 축소 */
    text-align: left; margin-left: 0 !important; /* 제목과 같은 왼쪽 라인 정렬 */
}
/* 메타 텍스트를 칩처럼 보이게 (문구가 span/em/i 등으로 들어와도 적용) */
.doc-item .doc-meta span,
.doc-item .doc-meta em,
.doc-item .doc-meta i {
    background: #eef2ff; 
    border: 1px solid #c7d2fe; 
    color: #475569; 
    padding: 2px 6px; 
    border-radius: 9999px; 
}

/* 모바일에서 한층 간결하게 */
@media (max-width: 768px) {
    .doc-item { padding: 8px 10px 10px 8px; }
    .doc-item .doc-title { font-size: 13.5px; }
    /* 모바일에선 제목 2줄, 메타 2줄로 여유 있게 */
    .doc-item .doc-title { -webkit-line-clamp: 2; max-height: 2.6em; }
    /* 메타를 삭제 버튼 아래쪽까지 가로질러 배치 */
    .doc-item .doc-meta { font-size: 10.5px; grid-column: 2 / 4; margin-top: 4px; }
    /* 타입 칩(첫 번째) 숨김: 아이콘으로 타입 인지가 가능하므로 중복 제거 */
    .doc-item .doc-meta span:first-child { display: none; }
}