:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
}

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

/* Header */
header {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

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

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Project List */
.project-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.project-item:last-child {
    border-bottom: none;
}

.project-item:hover {
    background: var(--light);
}

.project-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.project-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--secondary);
    margin-bottom: 0.75rem;
}

.project-summary {
    font-size: 0.875rem;
    color: var(--secondary);
    line-height: 1.5;
}

/* Status Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-reviewing { background: #dbeafe; color: #1e40af; }
.badge-quoted { background: #e0e7ff; color: #4338ca; }
.badge-accepted { background: #d1fae5; color: #065f46; }
.badge-in_progress { background: #ddd6fe; color: #5b21b6; }
.badge-testing { background: #fce7f3; color: #9f1239; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* Messages */
.message-list {
    max-height: 500px;
    overflow-y: auto;
}

.message-item {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    background: var(--light);
}

.message-item.admin {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.message-author {
    font-weight: 600;
    color: var(--dark);
}

.message-time {
    color: var(--secondary);
}

.message-content {
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* File Upload */
.file-list {
    margin-top: 0.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--light);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* 漢堡選單按鈕 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    padding: 0.5rem;
    z-index: 1002;
    position: relative;
}

/* 遮罩層 - 放在 media query 外面確保正確載入 */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100% - 280px);
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

.menu-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        flex-direction: column;
        padding: 4rem 1.5rem 1.5rem;
        transition: right 0.3s ease;
        z-index: 1100;
        overflow-y: auto;
        gap: 0;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        width: 100%;
        margin-bottom: 0;
    }
    
    .nav-links a {
        display: block;
        padding: 1rem 1.25rem;
        border-radius: 8px;
        transition: all 0.2s;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
    }
    
    .nav-links li:last-child a {
        border-bottom: none;
    }
    
    .nav-links a:hover {
        background: var(--light);
        color: var(--primary);
        transform: translateX(5px);
    }
    
    .project-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .container {
        padding: 0 15px;
    }
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 992px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border);
}

.pagination .btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    text-decoration: none;
}

.pagination .btn-primary {
    font-weight: bold;
    cursor: default;
}

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

@media (max-width: 576px) {
    .pagination {
        gap: 0.25rem;
        padding: 1rem 0.5rem;
    }
    
    .pagination .btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Utility */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
