/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: rgba(255,255,255,0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* 로그인 폼 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
}

/* 테이블 */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-top: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.table th:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.table tr:hover {
    background-color: #f8f9fa;
}

.table .status-active {
    color: #28a745;
    font-weight: bold;
}

.table .status-inactive {
    color: #dc3545;
    font-weight: bold;
}

/* 검색 및 필터 */
.filters {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

/* 알림 메시지 */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-info {
    background-color: #cce7ff;
    border: 1px solid #b3d9ff;
    color: #004085;
}

/* 카드 스타일 */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #333;
}

/* 그리드 레이아웃 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    flex: 1;
    padding: 0 10px;
}

.col-2 {
    flex: 0 0 16.666667%;
    padding: 0 10px;
}

.col-3 {
    flex: 0 0 25%;
    padding: 0 10px;
}

.col-4 {
    flex: 0 0 33.333333%;
    padding: 0 10px;
}

.col-6 {
    flex: 0 0 50%;
    padding: 0 10px;
}

.col-9 {
    flex: 0 0 75%;
    padding: 0 10px;
}

.col-12 {
    flex: 0 0 100%;
    padding: 0 10px;
    width: 100%;
}

/* 세금계산서 테이블 */
.tax-table {
    font-size: 12px;
}

.tax-table th,
.tax-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid #ddd;
}

.tax-status {
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

.tax-status:hover {
    background-color: #e9ecef;
}

.tax-issued {
    background-color: #d4edda;
    color: #155724;
}

.tax-partial {
    background-color: #fff3cd;
    color: #856404;
}

.tax-not-issued {
    background-color: #f8d7da;
    color: #721c24;
}

/* 인쇄 스타일 */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* 반응형 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .row {
        flex-direction: column;
        margin: 0;
    }
    
    .col,
    .col-2,
    .col-3,
    .col-4,
    .col-6,
    .col-9,
    .col-12 {
        flex: none;
        width: 100%;
        padding: 5px 0;
    }
}

/* 계약 타입별 섹션 스타일 */
.contract-type-section {
    transition: all 0.3s ease;
}

.contract-type-section[style*="none"] {
    display: none !important;
}

/* 상태 그리드 스타일 */
.status-grid {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    background-color: #f8f9fa;
}

.status-year {
    text-align: center;
}

.status-year h5 {
    margin-bottom: 10px;
    color: #333;
    text-align: center;
}

.status-months {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.month-item {
    text-align: center;
}

.month-item label {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    font-weight: 600;
    color: #666;
}

.form-control-sm {
    font-size: 11px;
    padding: 3px 6px;
    height: auto;
}

/* 동적 입력 아이템 스타일 */
.renewal-date-item,
.tenant-info-item {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    background-color: #f8f9fa;
}

.renewal-date-item:last-child,
.tenant-info-item:last-child {
    margin-bottom: 0;
}

/* 반응형 상태 그리드 */
@media (max-width: 768px) {
    .status-months {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
    
    .month-item label {
        font-size: 10px;
    }
    
    .form-control-sm {
        font-size: 10px;
        padding: 2px 4px;
    }
}

/* 월세 정보 관리 스타일 */
.monthly-rental-item {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 20px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.monthly-rental-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.rental-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rental-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 16px;
}

.rental-actions {
    display: flex;
    gap: 8px;
}

.rental-content {
    padding: 20px;
}

.rental-edit-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    text-align: right;
}

.rental-edit-actions .btn {
    margin-left: 10px;
}

.no-rentals-message {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
    border: 2px dashed #dee2e6;
}

.no-rentals-message p {
    margin: 0;
    font-size: 16px;
}

/* 월세 정보 필드 스타일 */
.rental-field[readonly] {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.rental-field:not([readonly]) {
    background-color: #ffffff;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* 상태 버튼 스타일 */
.status-btn {
    width: 100%;
    font-size: 11px;
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
    text-align: center;
}

.status-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-success {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

/* 연도 컨트롤러 스타일 */
.year-control-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    width: 100%;
}

.year-prev-btn, .year-next-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
    min-width: 35px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.year-prev-btn:hover, .year-next-btn:hover {
    background-color: #0056b3;
}

.year-prev-btn:active, .year-next-btn:active {
    background-color: #004085;
}

.year-dropdown {
    font-size: 18px;
    font-weight: 600;
    padding: 8px 12px;
    border: 2px solid #007bff;
    border-radius: 6px;
    background-color: white;
    color: #333;
    cursor: pointer;
    text-align: center;
    min-width: 120px;
    margin: 0 8px;
}

.year-dropdown:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.loading, .error {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #6c757d;
}

/* 전화번호 링크 스타일 */
.phone-link {
    color: #000000 !important;
    text-decoration: none !important;
    cursor: pointer;
}

.phone-link:hover {
    color: #333333 !important;
    text-decoration: none !important;
}

/* 토스트 메시지 스타일 */
.toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-size: 14px;
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.toast-message.fade-out {
    opacity: 0;
}

/* 객실 스티커 버튼 스타일 */
.room-sticker-btn {
    width: 30px !important;
    min-width: 30px !important;
    padding: 4px 6px !important;
    margin: 0 auto;
    display: block;
}

/* 월세 정보 메모 필드 크기 */
.rental-field[data-field="notes"] {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    resize: both !important;
    min-height: 80px !important;
    box-sizing: border-box !important;
}

/* 메모 필드 특별 스타일링 - 강력한 오버라이드 */
.notes-field-container {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    display: block !important;
    flex: 1 1 100% !important;
    flex-basis: 100% !important;
    flex-grow: 1 !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.notes-field-container .form-group {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: block !important;
}

.notes-field-container .form-control {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    display: block !important;
    margin: 0 !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    flex: none !important;
}

/* 메모가 포함된 row의 특별 스타일링 */
.notes-row {
    display: block !important;
    width: 100% !important;
    margin: 10px 0 !important;
    padding: 0 !important;
    flex-direction: column !important;
}

/* 메모 전용 컨테이너 스타일링 */
.notes-full-width {
    width: 100% !important;
    margin: 10px 0 !important;
    padding: 0 !important;
}

.notes-full-width .form-group {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.notes-full-width textarea {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    resize: both !important;
    min-height: 80px !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* 상태 월 라벨 클릭 가능 스타일 */
.month-item label {
    cursor: pointer;
    user-select: none;
    color: #007bff;
    text-decoration: underline;
}

.month-item label:hover {
    color: #0056b3;
}

/* 달력 팝업 스타일 */
.date-picker-popup {
    position: absolute !important;
    z-index: 9999 !important;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 10px;
    min-width: 200px;
}

.date-picker-popup input[type="date"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.date-picker-popup .btn-group {
    display: flex;
    gap: 5px;
}

.date-picker-popup .btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
}