/* 외래환자 자료 관리 시스템 스타일시트 */

/* 기본 레이아웃 */
.container-fluid {
    display: grid;
    background-color: white;
}

/* 헤더 스타일 */
.header {
    width: 100%;
    height: 100px;
    background: linear-gradient(135deg, #316694, #4a7ba7);
    color: white;
    padding: 20px 0 10px 20px;
    margin-bottom: 5px;
    justify-content: center;
    display: grid;
    grid-template-columns: 80% 20%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header .hleft h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
}

.header .hright {
    font-size: 16px;
    padding: 30px 20px;
    text-align: right;
}

.header .hright #log_out {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.header .hright #log_out:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* 메인 레이아웃 */
.main {
    display: grid;
    grid-template-columns: 30% 45% 25%;
    background-color: #f8f9fa;
    gap: 10px;
    padding: 10px;
    min-height: calc(100vh - 160px);
}

/* 사이드바 스타일 */
.sidebar {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.editing {
    position: -webkit-sticky;
    position: sticky;
    top: 10px;
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.editing ul.a {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.editing ul.a li {
    margin-bottom: 15px;
}

.editing input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.editing input[type="text"]:focus {
    outline: none;
    border-color: #316694;
    box-shadow: 0 0 0 2px rgba(49, 102, 148, 0.2);
}

.editing button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.editing #insert {
    background: #28a745;
    color: white;
}

.editing #insert:hover {
    background: #218838;
    transform: translateY(-1px);
}

.editing #update {
    background: #17a2b8;
    color: white;
}

.editing #update:hover {
    background: #138496;
    transform: translateY(-1px);
}

/* 컨텐츠 영역 */
.content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    min-height: 800px;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow-y: auto;
}

/* 카드 스타일 */
.card {
    margin-bottom: 15px;
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    padding: 12px 20px;
    font-weight: 600;
    color: #495057;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 20px;
    line-height: 1.6;
    color: #333;
}

.card-footer {
    background: transparent;
    border-top: 1px solid #dee2e6;
    padding: 12px 20px;
}

.card-footer .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    margin-left: 5px;
    transition: all 0.2s ease;
}

.card-footer .btn:hover {
    transform: translateY(-1px);
}

/* 우측 사이드바 */
.right_bar {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 15px;
}

#search {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

#search div {
    font-weight: 600;
    margin-bottom: 10px;
    color: #495057;
}

#search input[type="text"] {
    width: calc(100% - 80px);
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#search input[type="submit"] {
    width: 70px;
    padding: 8px;
    background: #316694;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
    transition: background 0.3s ease;
}

#search input[type="submit"]:hover {
    background: #2a5a84;
}

#divs {
    position: -webkit-sticky;
    position: sticky;
    top: 10px;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 15px;
}

#lname {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
}

#lname .btn {
    padding: 8px 4px;
    font-size: 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#lname .btn:hover {
    transform: translateY(-1px);
}

#divscon {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.6;
    border: 1px solid #e9ecef;
}

#divscon ol {
    padding-left: 20px;
}

#divscon li {
    padding: 8px 0;
    cursor: pointer;
    border-radius: 4px;
    padding-left: 10px;
    transition: background 0.2s ease;
}

#divscon li:hover {
    background: rgba(49, 102, 148, 0.1);
    color: #316694;
}

/* 달력 스타일 */
.calendar-container {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.calendar-nav {
    background: #316694;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.calendar-nav:hover {
    background: #2a5a84;
}

.calendar-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day-header {
    text-align: center;
    padding: 8px 4px;
    font-weight: 600;
    color: #666;
    background: #f8f9fa;
    font-size: 12px;
}

.calendar-day {
    text-align: center;
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 12px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day:hover {
    background: rgba(49, 102, 148, 0.1);
}

.calendar-day.other-month {
    color: #ccc;
}

.calendar-day.today {
    background: #316694;
    color: white;
    font-weight: 600;
}

.calendar-day.selected {
    background: #28a745;
    color: white;
}

.calendar-day.has-data {
    background: #ffeaa7;
    font-weight: 600;
}

/* 날짜 필터 */
.date-filter {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.date-filter label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.date-filter input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
}

.date-filter button {
    width: 100%;
    padding: 10px;
    background: #316694;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.date-filter button:hover {
    background: #2a5a84;
}

/* 푸터 */
.footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #666;
    font-size: 14px;
    border-top: 1px solid #e9ecef;
}

/* 알림 스타일 */
.alert {
    margin: 10px 0;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 14px;
}

.alert-light {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #495057;
}

/* 입력 필드 일반 스타일 */
input {
    margin: 5px 0;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: #316694;
    box-shadow: 0 0 0 2px rgba(49, 102, 148, 0.2);
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .main {
        grid-template-columns: 35% 40% 25%;
    }
}

@media (max-width: 992px) {
    .main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .header {
        grid-template-columns: 1fr;
        text-align: center;
        height: auto;
        padding: 15px;
    }
    
    .header .hright {
        padding: 10px 0;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 0;
    }
    
    .main {
        padding: 5px;
        gap: 5px;
    }
    
    .card-header {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .card-body {
        padding: 15px;
        font-size: 14px;
    }
    
    .calendar-day {
        min-height: 25px;
        font-size: 11px;
    }
}

/* 로딩 애니메이션 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(49, 102, 148, 0.3);
    border-radius: 50%;
    border-top-color: #316694;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 스크롤바 스타일링 */
.content::-webkit-scrollbar,
#divscon::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-track,
#divscon::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.content::-webkit-scrollbar-thumb,
#divscon::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.content::-webkit-scrollbar-thumb:hover,
#divscon::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}