/* 기본 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* 새로운 헤더 디자인 */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

/* 헤더 높이와 컨텐츠 마진 조정 */
.header-main {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-main h1 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 헤더 로고 스타일 */
.header-logo {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 8px;
    border-radius: 5px;
}

.header-sub {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.8rem 1rem;
}

/* 네비게이션 */
nav {
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
}

nav a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

nav a span {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

/* 메인 컨텐츠 */
main {
    margin-top: 250px; /* 헤더 높이 (메인 + 서브) 고려하여 증가 */
    padding: 1rem;
}

/* 검색 스타일 개선 */
.search-container {
    margin-top: -1rem; /* 마진을 줄여서 컨텐츠가 더 위로 올라가도록 */
    padding-bottom: 2rem;
}

.search-form {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-bottom: 1rem;
}

.search-input-group {
    display: flex;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 0.8rem;
    padding-right: 3rem;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 0.5rem;
    width: auto;
    cursor: pointer;
    color: #666;
}

/* 카드 레이아웃 스타일 */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 2rem;
}

/* 카드 스타일 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.card-category {
    background-color: #2c3e50;
    color: white;
    font-size: 0.8rem;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    font-weight: 500;
}

.card-date {
    color: #888;
    font-size: 0.8rem;
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: #333;
}

/* 정보 그리드 */
.info-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 0.8rem;
    align-items: center;
}

.info-grid .label {
    color: #666;
    font-size: 0.85rem;
    font-weight: 500;
}

.info-grid .value {
    color: #333;
    font-size: 0.95rem;
    word-break: break-word;
}

.url-link {
    color: #2c3e50;
    text-decoration: none;
}

.url-link:hover {
    text-decoration: underline;
}

/* 비밀번호 컨테이너 */
.password-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.password-field {
    width: 100%;
    padding: 0.6rem;
    padding-right: 2.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    background-color: #f8f9fa;
}

.toggle-password {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 40px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    padding: 0;
}

.toggle-password:hover {
    color: #333;
}

.toggle-password span {
    font-size: 1.2rem;
}

.no-results {
    background-color: #f8f9fa;
    padding: 3rem 1rem;
    text-align: center;
    border-radius: 8px;
    color: #666;
    font-size: 1rem;
}

/* 관리자 페이지 스타일 */
.manage-container {
    margin-bottom: 2rem;
}

.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.manage-header h2 {
    font-size: 1.3rem;
    font-weight: 500;
    color: #333;
}

.manage-actions {
    display: flex;
    gap: 0.5rem;
}

/* 탭 버튼 스타일 */
.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 30px;
    background: #f0f0f0;
    color: #555;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn span {
    font-size: 1.1rem;
}

.tab-btn.active {
    background: #2c3e50;
    color: white;
}

/* 탭 컨텐츠 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 테이블 스타일 */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.users-table th,
.users-table td {
    padding: 0.8rem;
    text-align: left;
}

.users-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 500;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
}

.users-table tr:not(:last-child) td {
    border-bottom: 1px solid #eee;
}

/* 권한 배지 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

.badge.admin {
    background-color: #2c3e50;
    color: white;
}

.badge.user {
    background-color: #e9ecef;
    color: #495057;
}

/* 액션 버튼 */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-toggle-admin {
    background-color: #6c757d;
    color: white;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
}

.inline-form {
    margin: 0;
    padding: 0;
}

/* 사용자 등록 폼 */
.register-form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-group.checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-group.checkbox input {
    width: auto;
    margin-right: 0.5rem;
}

.btn-primary {
    background-color: #2c3e50;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
}

/* 로그인 및 회원가입 페이지 스타일 */
.login-container, 
.signup-container {
    min-height: calc(100vh - 240px); /* 작은 값으로 변경 */
    display: flex;
    align-items: flex-start; /* center에서 flex-start로 변경 */
    justify-content: center;
    padding: 1rem; /* 상단 패딩 감소 */
    margin-top: -120px; /* 상단 마진을 음수로 추가하여 위로 이동 */
}

.login-form,
.signup-form {
    width: 100%;
    max-width: 380px;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 1.5rem; /* 헤더와의 간격 확보 */
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #2c3e50;
    outline: none;
}

.form-actions {
    margin-top: 1.8rem;
}

.form-actions button {
    width: 100%;
    padding: 0.8rem;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.form-actions button:hover {
    background: #1e2b38;
}

.form-links {
    margin-top: 1.5rem;
    text-align: center;
}

.signup-link,
.login-link {
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.signup-link:hover,
.login-link:hover {
    color: #1e2b38;
    text-decoration: underline;
}

.error-message {
    background: #fff5f5;
    color: #e53e3e;
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.success-message {
    background: #f0fff4;
    color: #38a169;
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

/* 비밀번호 입력 필드 컨테이너 */
.password-input-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
}

/* 홈 화면 추가 배너 */
.add-to-home-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
    transition: bottom 0.3s ease;
}

.add-to-home-banner.show {
    bottom: 0;
}

.add-to-home-content {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.add-to-home-icon {
    display: flex;
    align-items: center;
}

.add-to-home-icon img {
    border-radius: 8px;
}

.add-to-home-text {
    flex: 1;
}

.add-to-home-text strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
}

.add-to-home-text p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

.add-to-home-close {
    border: none;
    background: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0 0.5rem;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .header-main {
        padding: 0.8rem;
    }
    
    .header-sub {
        padding: 0.5rem;
    }
    
    main {
        padding: 0.5rem; 
        margin-top: 240px; /* 모바일에서 헤더 높이에 맞게 조정 */
    }
    
    .search-container {
        margin-top: -0.5rem;
    }
    
    .cards-container {
        gap: 0;
        margin-top: 0.5rem; /* 카드 컨테이너에 상단 여백 추가 */
    }
    
    .card {
        border-radius: 0;
        margin-bottom: 8px;
        box-shadow: none;
        border-bottom: 1px solid #eee;
    }
    
    .card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .card-header {
        padding: 0.7rem 0.8rem;
    }
    
    .card-body {
        padding: 0.8rem;
    }
    
    .info-grid {
        grid-template-columns: 70px 1fr;
        gap: 0.5rem 0.8rem;
    }
    
    .password-field {
        font-size: 16px; /* 모바일에서 자동 확대 방지 */
    }
    
    .toggle-password {
        width: 40px;
    }
    
    .manage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .manage-actions {
        width: 100%;
    }
    
    .tab-btn {
        flex: 1;
        justify-content: center;
    }
    
    .table-container {
        margin: 0 -0.5rem;
        border-radius: 0;
        box-shadow: none;
    }
    
    .users-table th,
    .users-table td {
        padding: 0.7rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .users-table th:nth-child(3),
    .users-table td:nth-child(3) {
        display: none; /* 모바일에서는 이메일 칼럼 숨김 */
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .btn-action {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .register-form {
        padding: 1rem;
        border-radius: 0;
        box-shadow: none;
    }
    
    .login-container, 
    .signup-container {
        padding: 0.5rem;
        margin-top: -10px; /* 모바일에서 덜 올림 */
        min-height: calc(100vh - 180px);
    }
    
    .login-form,
    .signup-form {
        padding: 1.5rem;
        box-shadow: none;
        border-radius: 0;
        margin-top: 0.5rem; /* 모바일에서는 더 좁은 간격 */
    }

    main {
        padding: 0.5rem;
        margin-top: 200px;
    }

    .header-logo {
        width: 20px;
        height: 20px;
        margin-right: 6px;
    }
}

/* 특별히 로그인/회원가입 페이지의 메인 콘텐츠 마진 조정 */
body:has(.login-container) main,
body:has(.signup-container) main {
    margin-top: 120px; /* 로그인/회원가입 페이지에서만 메인 여백 축소 */
}

@media (max-width: 768px) {
    body:has(.login-container) main,
    body:has(.signup-container) main {
        margin-top: 100px;
    }
}

/* 회원가입 폼 추가 스타일 */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-info {
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

.form-divider {
    margin: 1.5rem 0;
    border-top: 1px solid #eee;
    position: relative;
    text-align: center;
}

.form-divider span {
    background: white;
    padding: 0 0.8rem;
    position: relative;
    top: -0.7rem;
    color: #888;
    font-size: 0.9rem;
}

/* 회원가입 폼 추가 스타일 */
.form-info {
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

.form-divider {
    margin: 1.5rem 0;
    border-top: 1px solid #eee;
    position: relative;
    text-align: center;
}

.form-divider span {
    background: white;
    padding: 0 0.8rem;
    position: relative;
    top: -0.7rem;
    color: #888;
    font-size: 0.9rem;
}

.password-input-container {
    position: relative;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
}

.form-links {
    margin-top: 1.5rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.login-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
}

.login-link:hover {
    text-decoration: underline;
}

/* 푸터 스타일 */
.site-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 30px 20px 15px;
    margin-top: 40px;
    font-size: 14px;
    border-top: 1px solid #34495e;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.footer-section {
    flex: 1;
    min-width: 200px;
    padding: 0 15px;
    margin-bottom: 20px;
}

.footer-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #3498db;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: #3498db;
    text-decoration: underline;
}

.copyright {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #34495e;
    margin-top: 15px;
    font-size: 12px;
}

.admin-link {
    color: #e74c3c;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
    }
    
    .footer-section {
        margin-bottom: 25px;
    }
    
    .site-footer {
        padding: 20px 15px 10px;
    }
}