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

:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-color: #f5f7fa;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --text-color: #333;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 인증 페이지 (로그인/회원가입) */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 10px;
}

.logo-container {
    margin-top: -90px;
    margin-bottom: -20px;
}

.auth-logo {
    width: 250px;
    height: 250px;
    object-fit: contain;
}

.auth-header p {
    color: var(--secondary-color);
    font-size: 14px;
    margin-top: 0;
}

.auth-header h1 {
    color: var(--primary-color);
    font-size: 48px;
    margin-bottom: 10px;
    font-weight: 600;
}

.auth-header p {
    color: var(--secondary-color);
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.auth-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-form small {
    display: block;
    margin-top: 5px;
    color: var(--secondary-color);
    font-size: 12px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--secondary-color);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* 메일함 레이아웃 */
.mail-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 10px 20px 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}

.sidebar-logo {
    width: 155px;
    height: 155px;
    object-fit: contain;
    margin-top: -45px;
    margin-bottom: -45px;
}

.sidebar-header h1 {
    font-size: 24px;
    color: white;
    margin: 0;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background-color: var(--sidebar-hover);
    color: white;
    border-left: 3px solid var(--primary-color);
}

.nav-item .icon {
    margin-right: 10px;
    font-size: 18px;
}

.nav-item .badge {
    margin-left: auto;
    background-color: var(--danger-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 0;
}

.user-info {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* 메인 컨텐츠 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    overflow: hidden;
}

#mailListView {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#mailDetailView {
    display: none;
    flex-direction: column;
    height: 100%;
}

.mail-detail-content-full {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.toolbar {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: white;
    gap: 10px;
}

.search-box {
    flex: 1;
    display: flex;
    max-width: 500px;
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.search-box button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.btn-icon {
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background-color: var(--bg-color);
}

/* 메일 목록 */
.mail-list {
    flex: 1;
    overflow-y: auto;
}

.mail-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.mail-item:hover {
    background-color: var(--bg-color);
}

.mail-item.unread {
    background-color: #f0f8ff;
    font-weight: 600;
}

.mail-checkbox {
    margin-right: 15px;
}

.mail-star {
    margin-right: 15px;
    cursor: pointer;
    font-size: 18px;
}

.mail-star.starred {
    color: #ffc107;
}

.mail-info {
    flex: 1;
    min-width: 0;
}

.mail-recipient {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-from {
    font-weight: 500;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-subject {
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-preview {
    font-size: 13px;
    color: var(--secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-date {
    color: var(--secondary-color);
    font-size: 13px;
    margin-left: 15px;
    white-space: nowrap;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--secondary-color);
}

/* 메일 상세보기 */
.mail-detail-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 600px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.mail-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.mail-actions {
    display: flex;
    gap: 10px;
}

.mail-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.mail-detail-from {
    margin-bottom: 10px;
}

.mail-detail-subject {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
}

.mail-detail-meta {
    color: var(--secondary-color);
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.mail-detail-body {
    line-height: 1.8;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    gap: 10px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--bg-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 설정 페이지 */
.settings-content {
    padding: 30px;
    overflow-y: auto;
}

.settings-content h2 {
    margin-bottom: 10px;
}

.subtitle {
    color: var(--secondary-color);
    margin-bottom: 30px;
}

.settings-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.settings-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.account-form .form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
}

.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
}

.account-info {
    flex: 1;
}

.account-email {
    font-weight: 500;
    margin-bottom: 5px;
}

.account-provider {
    font-size: 13px;
    color: var(--secondary-color);
}

.account-actions {
    display: flex;
    gap: 10px;
}

.account-actions button {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.account-actions button:hover {
    background-color: var(--bg-color);
}

/* 반응형 */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .mail-detail-panel {
        width: 100%;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .search-box {
        max-width: 100%;
    }
}