/* 공통 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

/* 헤더 스타일 */
header {
    background-color: #333;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
}

header h1 {
    margin-bottom: 0.5rem;
}

header div {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

header select, header input, header button {
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 5px;
    border: none;
}

header button {
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
}

header button:hover {
    background-color: #0056b3;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

nav ul li {
    display: inline;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
}

nav ul li a:hover {
    text-decoration: underline;
}

/* 레이아웃 스타일 */
.container {
    flex: 1; /* 본문을 채우기 위한 flex-grow */
    display: flex; /* 필요한 경우 레이아웃 내의 정렬 유지 */
    flex-direction: row; /* 좌측 사이드바와 본문 정렬 */
}

aside {
    width: 30%;
    background-color: #f4f4f4;
    padding: 15px;
    border-right: 1px solid #ddd;
}

aside ul {
    list-style: none;
    padding: 0;
}

aside ul li {
    padding: 10px;
    margin-bottom: 5px;
    background-color: #fff;
    border-radius: 5px;
}

aside ul li:hover {
    background-color: #007bff;
    color: white;
    cursor: pointer;
}

main {
    flex: 1;
    padding: 20px;
    background-color: #fff;
    width: 75%;
    float: right;
    box-sizing: border-box;
    text-align: center;
}

main ul {
    list-style: none;
    padding: 0;
}

main ul li {
    margin: 10px 0;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #fff;
    border-radius: 5px;
}

.buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.button {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
}

.button:hover {
    background-color: #0056b3;
}

/* 푸터 스타일 */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto; /* Flexbox에서 footer를 하단으로 보내기 위한 옵션 */
}

/* Login 페이지 스타일 */
.login-page {
    background-color: #222;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container .background {
    position: relative;
    width: 100%;
    height: 100%;
    background: url('../images/skating1.png') no-repeat center center/contain;
}

.login-container .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.login-container .content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
}

.login-container .content h1 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-container input[type="text"], .login-container input[type="password"] {
    padding: 10px;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    margin: 5px 0;
}

.login-container button {
    padding: 10px;
    font-size: 1rem;
    background-color: #00bfff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.login-container button:hover {
    background-color: #0099cc;
}

.text-color-red {
    color: red;
}

.text-color-green {
    color: green;
}

.text-color-blue {
    color: blue;
}

/* 로딩 오버레이 스타일 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content img {
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #333;
    padding: 10px 15px;
    color: white;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
}

.header-center {
    flex-grow: 1;
    justify-content: center;
}

.home-icon {
    font-size: 24px;
    color: white;
    text-decoration: none;
}





/* 반응형 스타일 */
@media screen and (max-width: 768px) {
    aside, main {
        width: 100%;
        float: none;
    }

    main {
        order: 1;
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    nav ul li a {
        font-size: 1rem;
    }

    .button {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    main ul li {
        font-size: 14px;
        padding: 8px;
    }

    .buttons {
        flex-direction: column;
    }

    /* 추가: footer 스타일 */
    footer {
        margin-top: auto;
        position: absolute; /* 모바일 환경에서 정상적인 배치를 유지 */
        bottom: 0;
        width: 100%;
    }
}



@media screen and (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }

    .buttons {
        flex-direction: column;
        align-items: center;
    }

    .button {
        width: 90%;
        margin: 5px 0;
    }

    main ul li {
        font-size: 12px;
        padding: 5px;
    }

    /* 추가: footer 스타일 */
    footer {
        margin-top: auto;
        position: absolute; /* 모바일 환경에서 정상적인 배치를 유지 */
        bottom: 0;
        width: 100%;
    }
}

/* ===== Lesson Form (작성/수정) ===== */
.page-lesson-form main{
    width:100% !important;       /* 전역 75% 덮어쓰기 */
    float:none !important;
    max-width:960px;              /* 데스크톱 가독 폭 */
    margin:0 auto;
    text-align:left;
}

.card{
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:12px;
    padding:18px;
    box-shadow:0 2px 10px rgba(0,0,0,.04);
}

.form-header{
    display:flex; align-items:center; justify-content:space-between;
    gap:12px; margin-bottom:14px;
}

.menu-buttons.compact a{
    padding:8px 12px; border-radius:8px; background:#007bff; color:#fff; text-decoration:none;
    display:inline-flex; align-items:center; gap:6px; font-weight:600;
}
.menu-buttons.compact a:hover{ background:#005fd1; }

.form-grid{
    display:grid; gap:14px;
    grid-template-columns:1fr;     /* 모바일: 1열 */
}
.form-item{ display:grid; gap:8px; }
.form-item label{ font-weight:700; font-size:.95rem; color:#374151; }
.form-item input[type="text"],
.form-item input[type="date"],
.form-item input[type="number"],
.form-item textarea,
.form-item select{
    width:100%; padding:10px 12px; border:1px solid #d1d5db; border-radius:8px; font-size:1rem;
    background:#fff;
}
.form-item textarea{ min-height:96px; resize:vertical; }

@media (min-width: 768px){
    .form-grid{ grid-template-columns: 1fr 1fr; }          /* 태블릿+ : 2열 */
    .form-item.full{ grid-column: 1 / -1; }                /* 가로로 길게 쓰는 필드 */
}

.hint{ font-size:.85rem; color:#6b7280; }

.attach-wrap{
    display:flex; align-items:flex-start; gap:12px; flex-wrap:wrap;
}
.attach-tile{
    position:relative; width:110px; height:110px; border:1px solid #e5e7eb;
    border-radius:10px; overflow:hidden; background:#f9fafb;
    display:flex; align-items:center; justify-content:center;
}
.attach-tile img, .attach-tile video{ max-width:100%; max-height:100%; display:block; }
.attach-tile .del{
    position:absolute; left:8px; bottom:8px; display:flex; align-items:center; gap:4px;
    background:rgba(0,0,0,.55); color:#fff; border-radius:6px; padding:3px 6px; font-size:.8rem;
}

.actions{ display:flex; gap:8px; margin-top:14px; }
.btn{ padding:10px 14px; border-radius:8px; font-weight:700; border:0; cursor:pointer; }
.btn-primary{ background:#007bff; color:#fff; }
.btn-primary:hover{ background:#0066d4; }
.btn-danger{ background:#ef4444; color:#fff; }
.btn-danger:hover{ background:#dc2626; }

/* ===== Lesson Form (AJAX 버전) - 반응형 개선 & 시각 스타일 ===== */
main form#form{
    /* 전역 main의 text-align:center 덮어쓰기 */
    text-align: left;

    /* 데스크톱/태블릿에서 읽기 좋은 폭 */
    max-width: 960px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);

    /* 폼 전반 타이포 */
    font-size: 16px;
    line-height: 1.5;
}

/* 라벨 + 입력 블록 공통 */
main form#form > div{
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

/* 라벨 스타일 */
main form#form label{
    font-weight: 700;
    font-size: .95rem;
    color: #374151;
}

/* 인풋/셀렉트/텍스트영역 공통 */
main form#form input[type="text"],
main form#form input[type="date"],
main form#form input[type="number"],
main form#form input[type="file"],
main form#form textarea,
main form#form select{
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}
main form#form textarea{
    min-height: 110px;
    resize: vertical;
}

/* 버튼 영역 정렬 */
main form#form > div:last-of-type{
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 기존 .button 보강(모바일 터치 크기) */
.button{
    min-height: 42px;
    padding: 10px 16px;
    font-weight: 700;
    border-radius: 8px;
}

/* ----- 첨부 미리보기 영역 ----- */
.preview{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}
.preview img,
.preview video{
    display: block;
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}

/* ----- 기존 첨부 파일 영역 ----- */
#attached{
    margin-top: 10px;
}
#attached h4{
    margin: 8px 0;
    font-size: 1rem;
}
#attached > div{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
#attached img,
#attached video{
    display: block;
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}
#attached label{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .9rem;
    margin-left: 6px;
}

/* ----- 헤더/내비 보조 ----- */
header h1{
    font-size: 1.6rem;
}
nav ul{
    gap: .5rem;
}
nav ul li a{
    font-size: 1rem;
}

/* ===== 반응형 ===== */
@media (min-width: 768px){
    /* 두 칼럼 형태로 더 컴팩트하게: 날짜/코치/숙련도 등 배치 향상 */
    main form#form{
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 16px;
    }
    /* 버튼 영역은 전체 칼럼 차지 */
    main form#form > div:last-of-type{
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
    /* 넓게 쓰는 항목(주제/내용/다음 목표/첨부/기존 첨부)은 가로 전체 */
    main form#form > div:nth-child(4),  /* 주제 */
    main form#form > div:nth-child(5),  /* 내용 */
    main form#form > div:nth-child(6),  /* 다음 목표 */
    main form#form > div:nth-child(8),  /* 첨부 */
    #attached{
        grid-column: 1 / -1;
    }
}

@media (max-width: 767.98px){
    /* 카드 여백 축소 */
    main form#form{
        padding: 14px;
        border-radius: 10px;
    }
    .button{
        flex: 1 1 auto;   /* 버튼이 한 줄에서 균등 확장 */
        text-align: center;
    }
    /* 푸터가 화면을 덮지 않도록 전역 footer 고정 해제 유의(기존 CSS의 absolute가 있으면 제거 권장) */
}

/* (선택) 삭제 버튼 빨간 톤 통일: inline style 대신 사용할 때 */
/* .button-danger{ background:#dc3545; }
   .button-danger:hover{ background:#bb2d3b; } */


/* lesson-form 페이지: 오른쪽 회색 여백 제거 */
.page-lesson-form main {
    width: 100% !important;       /* 전체 폭 사용 */
    float: none !important;
    margin: 0 auto;
    text-align: left;
    background-color: #fff;       /* 본문 배경을 흰색으로 */
    padding: 1rem;
    box-sizing: border-box;
}

/* PC에서만 중앙 정렬 + 최대폭 제한 */
@media (min-width: 1024px) {
    .page-lesson-form main {
        max-width: 960px;         /* PC 가독성을 위한 폭 제한 */
        border-radius: 8px;       /* 카드처럼 보이게 */
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
}

/* 모바일은 꽉 차게 */
@media (max-width: 1023px) {
    .page-lesson-form main {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
}