/* =========================================
   留言板系统 - 橙白配色主题样式表
   2026
   ========================================= */

/* CSS Variables */
:root {
    --primary: #FF6B35;
    --primary-dark: #E55A2B;
    --primary-light: #FF8A5C;
    --secondary: #FFA94D;
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
}

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.header .logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header .logo svg { width: 28px; height: 28px; }

.header-nav { display: flex; align-items: center; gap: 8px; }

.header-nav a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 500;
}

.header-nav a:hover, .header-nav a.active {
    background: rgba(255,255,255,0.2);
    color: var(--white);
}

.header-nav .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
}

.header-nav .user-info span { font-weight: 500; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-secondary:hover { background: var(--gray-50); }

.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: #DC3545; color: var(--white); }
.btn-danger:hover { background: #C82333; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.btn svg { width: 18px; height: 18px; }

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

/* Form Elements */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}

.form-control.error { border-color: #DC3545; }

textarea.form-control { resize: vertical; min-height: 120px; }

.form-error {
    color: #DC3545;
    font-size: 13px;
    margin-top: 6px;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 40px 20px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo svg { width: 64px; height: 64px; color: var(--primary); }

.auth-logo h1 {
    font-size: 26px;
    color: var(--gray-900);
    margin-top: 16px;
}

.auth-logo p { color: var(--gray-500); margin-top: 4px; }

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.auth-tab:hover { color: var(--primary); }

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--gray-500);
}

.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* Message List */
.message-list { list-style: none; }

.message-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.message-item:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.message-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 16px;
}

.message-author-info { display: flex; flex-direction: column; }

.message-author-name { font-weight: 700; color: var(--gray-900); }

.message-time { font-size: 12px; color: var(--gray-500); }

.message-content {
    color: var(--gray-700);
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

.message-ip { font-size: 12px; color: var(--gray-400); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination a {
    background: var(--white);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.pagination a:hover { border-color: var(--primary); color: var(--primary); }

.pagination .current {
    background: var(--primary);
    color: var(--white);
}

.pagination .disabled { opacity: 0.5; cursor: not-allowed; }

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid #28A745; }
.toast.error { border-left: 4px solid #DC3545; }
.toast.info { border-left: 4px solid #17A2B8; }

.toast svg { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success svg { color: #28A745; }
.toast.error svg { color: #DC3545; }
.toast.info svg { color: #17A2B8; }

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state svg { width: 80px; height: 80px; color: var(--gray-300); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }

/* Table (Admin) */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 700;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td { background: var(--gray-50); }

/* Status Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #D4EDDA; color: #155724; }
.badge-danger { background: #F8D7DA; color: #721C24; }
.badge-warning { background: #FFF3CD; color: #856404; }

/* Admin Layout */
.admin-body {
    background: var(--gray-100);
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
}

.sidebar-header h2 { font-size: 18px; margin-bottom: 4px; }
.sidebar-header small { opacity: 0.8; font-size: 12px; }

.sidebar-nav { padding: 16px 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover { background: var(--gray-50); color: var(--primary); }

.sidebar-nav a.active {
    background: rgba(255,107,53,0.08);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-nav svg { width: 20px; height: 20px; }

.admin-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--gray-500);
    font-size: 13px;
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; height: auto; padding: 12px; gap: 12px; }
    .header-nav { flex-wrap: wrap; justify-content: center; }
    .auth-card { padding: 28px 20px; }
    .admin-sidebar { width: 200px; }
    .admin-content { margin-left: 200px; }
}

@media (max-width: 480px) {
    .admin-sidebar { display: none; }
    .admin-content { margin-left: 0; }
    .pagination a, .pagination span { min-width: 36px; height: 36px; font-size: 13px; }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal { background: var(--white); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: 90vh; overflow: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 18px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
