body {
    padding-top: 80px; /* 헤더 높이만큼 상단 여백 추가 */
}

.msg-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    min-height: 600px;
}

/* PC에서 좌우 분할 레이아웃 */
@media (min-width: 1024px) {
    .content-wrapper {
        display: flex;
        gap: 30px;
        align-items: flex-start;
    }

    .main-content {
        flex: 1;
        max-width: calc(100% - 430px); /* 미리보기 공간 확보 */
    }

    .mobile-preview-desktop {
        flex: 0 0 400px; /* 고정 너비 */
        position: sticky;
        top: 20px;
    }
}

.main-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-top: 20px;
}

.page-title {
    color: #333;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.page-subtitle {
    color: #666;
    font-size: 16px;
    text-align: center;
    margin-bottom: 30px;
}

.submenu {
    display: flex;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.submenu a {
    flex: 1;
    text-align: center;
    padding: 12px 20px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.submenu a.active {
    background: linear-gradient(135deg, #5865F2, #4752C4);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

.submenu a:hover:not(.active) {
    background: #e9ecef;
    color: #333;
}

.content-area {
    padding: 30px;
}


.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.form-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.form-label {
    min-width: 100px;
    font-weight: 600;
    color: #333;
}

.form-input, .form-select {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.recipient-section {
    margin-bottom: 30px;
}

.recipient-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recipient-table th {
    background: #f1f3f4;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
}

.recipient-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.recipient-table tbody tr:hover {
    background: #f8f9fa;
}

.recipient-table input[type="text"] {
    width: 100%;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
}

.recipient-table input[type="checkbox"] {
    transform: scale(1.2);
}

/* 수신자 목록 스크롤 컨테이너 */
.recipient-table-container {
    max-height: 500px; /* 약 10개 행 정도의 높이 */
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 테이블 헤더 고정 */
.recipient-table-container .recipient-table {
    border: none;
    margin: 0;
}

.recipient-table-container .recipient-table thead th {
    position: sticky;
    top: 0;
    background: #f1f3f4;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 스크롤바 스타일링 */
.recipient-table-container::-webkit-scrollbar {
    width: 8px;
}

.recipient-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.recipient-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.recipient-table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 테이블 행 번호 표시 개선 */
.recipient-table tbody tr {
    position: relative;
}

/* 스크롤 시 더 나은 시각적 피드백 */
.recipient-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.recipient-table tbody tr:nth-child(odd) {
    background-color: white;
}

.recipient-table tbody tr:hover {
    background-color: #e3f2fd !important;
    transition: background-color 0.2s ease;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.table-info {
    color: #666;
    font-size: 14px;
}

.table-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #5865F2;
    color: white;
}

.btn-primary:hover {
    background: #4752C4;
}

.btn-secondary {
    background: white;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

.send-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
}

.send-info {
    font-size: 14px;
    color: #666;
}

.send-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

/* 모바일 미리보기 */
.mobile-preview-inline {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 20px;
    margin: 30px auto;
    max-width: 350px;
}

/* PC 화면에서는 오른쪽 고정 */
@media (min-width: 1024px) {
    .mobile-preview-inline {
        display: none; /* PC에서는 인라인 미리보기 숨김 */
    }

    .mobile-preview-desktop {
        display: block;
        width: 100%;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        padding: 20px;
    }
}

/* 태블릿에서는 인라인 표시 */
@media (min-width: 768px) and (max-width: 1023px) {
    .mobile-preview-desktop {
        display: none;
    }

    .mobile-preview-inline {
        display: block;
    }
}

/* 모바일 화면에서는 인라인 표시 */
@media (max-width: 767px) {
    .mobile-preview-desktop {
        display: none; /* 모바일에서는 데스크탑 미리보기 숨김 */
    }

    .mobile-preview-inline {
        display: block; /* 모바일에서는 인라인 미리보기 표시 */
    }
}

.phone-frame {
    background: #333;
    padding: 20px;
    border-radius: 25px;
    position: relative;
}

.phone-screen {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    min-height: 500px; /* 최소 높이 설정 */
    display: flex;
    flex-direction: column;
}

.phone-header {
    background: #f8f9fa;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.message-preview {
    padding: 8px;
    flex: 1; /* 내용에 맞게 늘어남 */
    min-height: 200px; /* 최소 높이 */
}

.char-counter {
    background: #f8f9fa;
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

/* 로딩 오버레이 스타일 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #5865F2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 300px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin: 20px auto;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5865F2, #4752C4);
    width: 0%;
    transition: width 0.3s ease;
}

/* 전송옵션 스타일 */
.send-options {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.option-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

.option-label {
    min-width: 120px;
    font-weight: 600;
    color: #333;
    position: relative;
    flex-shrink: 0;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .send-options {
        padding: 15px;
    }

    .option-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .option-label {
        min-width: auto;
        margin-bottom: 5px;
    }

    .range-inputs {
        justify-content: flex-start;
    }

    .range-inputs input {
        width: 90px;
        padding: 8px;
    }

    .range-warning {
        font-size: 11px;
        padding: 6px 10px;
    }

    #sendResultArea {
        padding: 15px !important;
        font-size: 14px;
    }

    #sendResultArea h4 {
        font-size: 16px !important;
    }

    #sendResultArea ul {
        font-size: 13px;
    }

    .option-select, .option-input {
        padding: 8px;
        font-size: 16px; /* iOS 줌 방지 */
    }

    .tooltip .tooltiptext {
        width: 250px;
        margin-left: -125px;
        font-size: 11px;
    }
}

.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 5px;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 300px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -150px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.option-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.option-select {
    min-width: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-inputs input {
    width: 110px;
}

.range-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #fff3e0;
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 12px;
    color: #f57c00;
    line-height: 1.5;
}

/* 예약전송 스타일 */
.schedule-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.schedule-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
}

.schedule-display {
    padding: 8px 12px;
    background: #e3f2fd;
    border: 1px solid #2196F3;
    border-radius: 5px;
    color: #1565C0;
    font-size: 14px;
    display: none;
}

/* 달력 모달 스타일 */
.calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.calendar-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 350px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.nav-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.current-month {
    font-weight: bold;
    color: #333;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 20px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.day-header {
    background: #f8f9fa;
    font-weight: bold;
    color: #666;
    cursor: default;
}

.day-number {
    color: #333;
}

.day-number:hover {
    background: #e3f2fd;
}

.day-selected {
    background: #2196F3 !important;
    color: white !important;
}

.day-disabled {
    color: #ccc;
    cursor: not-allowed;
}

.time-section {
    margin-bottom: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.time-label {
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-select {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.calendar-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-cancel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
}

.btn-confirm {
    background: #2196F3;
    border: 1px solid #2196F3;
    color: white;
}

/* 비활성화된 버튼 스타일 */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e9ecef;
    color: #6c757d;
    border-color: #dee2e6;
}

.message-bubble {
    background: #007bff;
    color: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 95%;
    margin-left: auto;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.message-info {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-bottom: 20px;
}


.preview-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

@media (max-width: 1200px) {
    .msg-container {
        flex-direction: column;
    }

    .mobile-preview {
        width: 100%;
        position: relative;
    }
}

/* 토스트 알림 스타일 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #28a745;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left-color: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.toast-message {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #666;
}