/* 리셋 및 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--color-slate-50, #f8fafc);
    transition: background-color 0.3s ease;
}

[data-theme='dark'] body {
    background: var(--color-slate-950, #020617);
}

.tool-section {
    background: transparent;
}

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

/* 로딩 섹션 */
.loading-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] .loading-section {
    background: var(--color-slate-800, #1e293b);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-section p {
    margin-top: 20px;
    font-size: 16px;
    color: var(--color-slate-600, #475569);
}

[data-theme='dark'] .loading-section p {
    color: var(--color-slate-300, #cbd5e1);
}

/* 이메일 카드 */
.email-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 30px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.email-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px 20px 0 0;
}

.email-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

[data-theme='dark'] .email-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(51, 65, 85, 0.8);
}

[data-theme='dark'] .email-card::before {
    background: linear-gradient(90deg, #667eea 0%, #a78bfa 100%);
}

.email-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-slate-600, #475569);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

[data-theme='dark'] .email-title {
    color: var(--color-slate-400, #94a3b8);
}

.email-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.email-input {
    flex: 1;
    padding: 18px 24px;
    font-size: 17px;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: 14px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--color-slate-900, #0f172a);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.email-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme='dark'] .email-input {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: transparent;
    color: var(--color-slate-100, #f1f5f9);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .email-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-icon {
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-icon:hover::before {
    left: 100%;
}

.btn-icon:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3fa0 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-icon:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* 메타 정보 */
.email-meta {
    display: flex;
    gap: 30px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);
    border-radius: 14px;
    margin-bottom: 20px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

[data-theme='dark'] .email-meta {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 1px solid rgba(51, 65, 85, 0.6);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-slate-900, #0f172a);
}

[data-theme='dark'] .meta-item {
    color: var(--color-slate-100, #f1f5f9);
}

.meta-icon {
    font-size: 20px;
}

.meta-label {
    color: var(--color-slate-600, #475569);
    font-weight: 500;
}

[data-theme='dark'] .meta-label {
    color: var(--color-slate-300, #cbd5e1);
}

.meta-value {
    font-weight: 700;
    color: var(--color-slate-900, #0f172a);
}

[data-theme='dark'] .meta-value {
    color: var(--color-slate-100, #f1f5f9);
}

/* 액션 버튼 */
.email-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action {
    flex: 1;
    min-width: 120px;
    padding: 13px 22px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-action::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-action:hover::after {
    width: 300px;
    height: 300px;
}

.btn-action svg {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-action:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3fa0 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: var(--color-slate-700, #334155);
    box-shadow: 0 4px 12px rgba(148, 163, 184, 0.2);
}

[data-theme='dark'] .btn-secondary {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    color: var(--color-slate-100, #f1f5f9);
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    box-shadow: 0 6px 20px rgba(148, 163, 184, 0.3);
}

[data-theme='dark'] .btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    box-shadow: 0 6px 20px rgba(51, 65, 85, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* 받은편지함 섹션 */
.inbox-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}

.inbox-section:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
}

[data-theme='dark'] .inbox-section {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(51, 65, 85, 0.8);
}

.inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-slate-200, #e2e8f0);
}

[data-theme='dark'] .inbox-header {
    border-bottom-color: var(--color-slate-700, #334155);
}

.inbox-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-slate-900, #0f172a);
}

[data-theme='dark'] .inbox-title {
    color: var(--color-slate-100, #f1f5f9);
}

.inbox-count-badge {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

/* 이메일 리스트 */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-item {
    padding: 18px;
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.email-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

[data-theme='dark'] .email-item {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.email-item:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-3px) translateX(4px);
    background: linear-gradient(135deg, #ffffff 0%, #faf5ff 100%);
}

[data-theme='dark'] .email-item:hover {
    background: linear-gradient(135deg, #312e81 0%, #1e293b 100%);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.email-item:hover::before {
    transform: scaleY(1);
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--color-slate-500, #64748b);
}

[data-theme='dark'] .email-header {
    color: var(--color-slate-400, #94a3b8);
}

.subject {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--color-slate-900, #0f172a);
}

[data-theme='dark'] .subject {
    color: var(--color-slate-100, #f1f5f9);
}

.preview {
    font-size: 14px;
    color: var(--color-slate-600, #475569);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme='dark'] .preview {
    color: var(--color-slate-400, #94a3b8);
}

/* 빈 받은편지함 */
.empty-inbox {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    margin-bottom: 20px;
    color: var(--color-slate-300, #cbd5e1);
}

[data-theme='dark'] .empty-icon {
    color: var(--color-slate-600, #475569);
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-slate-700, #334155);
    margin-bottom: 8px;
}

[data-theme='dark'] .empty-title {
    color: var(--color-slate-300, #cbd5e1);
}

.empty-desc {
    font-size: 14px;
    color: var(--color-slate-500, #64748b);
}

[data-theme='dark'] .empty-desc {
    color: var(--color-slate-400, #94a3b8);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

[data-theme='dark'] .modal-content {
    background: var(--color-slate-800, #1e293b);
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-slate-900, #0f172a);
    margin-bottom: 12px;
}

[data-theme='dark'] .modal-content h3 {
    color: var(--color-slate-100, #f1f5f9);
}

.modal-content p {
    color: var(--color-slate-600, #475569);
    margin-bottom: 20px;
    line-height: 1.6;
}

[data-theme='dark'] .modal-content p {
    color: var(--color-slate-300, #cbd5e1);
}

.extend-options {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-extend-time {
    flex: 1;
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-extend-time:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-cancel {
    width: 100%;
    padding: 12px;
    background: var(--color-slate-200, #e2e8f0);
    color: var(--color-slate-700, #334155);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

[data-theme='dark'] .btn-cancel {
    background: var(--color-slate-700, #334155);
    color: var(--color-slate-100, #f1f5f9);
}

.btn-cancel:hover {
    background: var(--color-slate-300, #cbd5e1);
}

[data-theme='dark'] .btn-cancel:hover {
    background: var(--color-slate-600, #475569);
}

/* 이메일 상세 모달 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-slate-200, #e2e8f0);
}

[data-theme='dark'] .modal-header {
    border-bottom-color: var(--color-slate-700, #334155);
}

.modal-close {
    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-slate-400, #94a3b8);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--color-slate-100, #f1f5f9);
    color: var(--color-slate-700, #334155);
}

[data-theme='dark'] .modal-close:hover {
    background: var(--color-slate-700, #334155);
    color: var(--color-slate-200, #e2e8f0);
}

.modal-body {
    color: var(--color-slate-700, #334155);
}

[data-theme='dark'] .modal-body {
    color: var(--color-slate-300, #cbd5e1);
}

.email-meta {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-slate-200, #e2e8f0);
}

[data-theme='dark'] .email-meta {
    border-bottom-color: var(--color-slate-700, #334155);
}

.email-meta div {
    margin-bottom: 8px;
    color: var(--color-slate-700, #334155);
}

[data-theme='dark'] .email-meta div {
    color: var(--color-slate-300, #cbd5e1);
}

.email-body {
    line-height: 1.6;
}

/* 첨부파일 */
.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-slate-50, #f8fafc);
    border-radius: 8px;
    transition: all 0.3s;
}

[data-theme='dark'] .attachment-item {
    background: var(--color-slate-900, #0f172a);
}

.attachment-item:hover {
    background: var(--color-slate-100, #f1f5f9);
}

[data-theme='dark'] .attachment-item:hover {
    background: var(--color-slate-800, #1e293b);
}

.attachment-icon {
    font-size: 20px;
}

.attachment-name {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.attachment-name:hover {
    text-decoration: underline;
}

.attachment-size {
    color: var(--color-slate-500, #64748b);
    font-size: 13px;
}

[data-theme='dark'] .attachment-size {
    color: var(--color-slate-400, #94a3b8);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .email-meta {
        flex-direction: column;
        gap: 12px;
    }

    .email-actions {
        flex-direction: column;
    }

    .btn-action {
        width: 100%;
    }

    .extend-options {
        flex-wrap: wrap;
    }

    .btn-extend-time {
        flex-basis: calc(50% - 5px);
    }
}
