:root {
    --primary: #1a365d;
    --primary-dark: #0f2744;
    --accent: #4299e1;
    --accent-hover: #3182ce;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-light: #a0aec0;
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-tertiary: #edf2f7;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.05);
    --shadow-hover: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ログインページ */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--bg-primary);
    padding: 48px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease-out;
}

.login-box h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(66, 153, 225, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

/* メインレイアウト */
.main-container {
    display: flex;
    height: 100vh;
    background: var(--bg-secondary);
}

/* サイドバー */
.sidebar {
    width: 280px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 12px var(--shadow);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-header .user-email {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

.compose-btn {
    margin: 24px;
    background: var(--accent);
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.compose-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(66, 153, 225, 0.4);
}

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

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

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

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

/* メインコンテンツ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ヘッダー */
.content-header {
    background: var(--bg-primary);
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* メール一覧 */
.email-list-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

.email-list {
    list-style: none;
}

.email-item {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.email-item:hover {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent);
    padding-left: 28px;
}

.email-item.unread {
    background: #f0f9ff;
}

.email-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.email-content {
    flex: 1;
    min-width: 0;
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.email-from {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.email-item.unread .email-from {
    font-weight: 700;
}

.email-date {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
}

.email-subject {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 500;
}

.email-item.unread .email-subject {
    font-weight: 600;
}

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

.email-meta {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-attachment {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* メール詳細 */
.email-detail-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    padding: 32px;
}

.email-detail-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.email-detail-subject {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.email-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sender-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.sender-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 22px;
}

.sender-details {
    flex: 1;
}

.sender-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.sender-email {
    font-size: 14px;
    color: var(--text-secondary);
}

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

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.email-detail-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 32px;
}

.attachments {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.attachments-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.attachment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.attachment-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.attachment-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

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

.attachment-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-size {
    font-size: 12px;
    color: var(--text-secondary);
}

/* メール作成 */
.compose-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    padding: 32px;
}

.compose-form {
    max-width: 900px;
    margin: 0 auto;
}

.compose-field {
    margin-bottom: 20px;
}

.compose-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.compose-field input,
.compose-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.compose-field input:focus,
.compose-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.compose-field textarea {
    min-height: 400px;
    resize: vertical;
}

.compose-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.file-upload {
    display: none;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.file-upload-btn:hover {
    background: var(--border);
}

/* アラート */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-left: 4px solid var(--danger);
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
    border-left: 4px solid var(--accent);
}

/* ローディング */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* アニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* レスポンシブ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .search-box {
        width: 100%;
    }
    
    .content-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .email-item {
        padding: 16px 20px;
    }
}

/* ユーティリティ */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}
