:root {
    --primary-color: #094362;
    --secondary-color: #FFFFFF;
    --text-color: #333;
    --border-color: #ccc;
    --success-color: #28a745;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--secondary-color);
    color: var(--text-color);
}

header {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Brand/logo styling */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.2em;
}

.brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: transparent;
}

.brand-text {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Navigation & Hamburger Menu */
.hamburger-menu {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 1.8em;
    cursor: pointer;
    padding: 5px;
    display: block; /* Always visible on mobile/desktop */
    z-index: 1001;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    top: 60px; /* Adjust based on header height */
    right: 0;
    background-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 200px;
    z-index: 1000;
    transition: transform 0.3s ease-out;
    transform: translateX(100%);
}

.nav-menu.visible {
    transform: translateX(0);
}

.nav-menu li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--secondary-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none;
}

main {
    padding: 20px;
}

/* Form Styling */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

button {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #063148; /* Slightly darker primary */
}

.ad-preview {
    margin-top: 20px;
    border: 1px dashed var(--primary-color);
    padding: 15px;
    text-align: center;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-preview img {
    max-width: 100%;
    max-height: 200px;
    margin-bottom: 10px;
    border-radius: 4px;
}

/* AI Prompt specific button styling */
#generate-image-btn {
    margin-top: 5px;
    width: 100%;
}

/* 新增：簡單 spinner 顯示在預覽佔位文字左側 */
.preview-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* Spinner 動畫 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Admin Table Styling */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.admin-table th, .admin-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

.admin-table th {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    font-weight: normal;
}

.status-approved {
    color: var(--success-color);
    font-weight: bold;
}

.status-pending {
    color: orange;
    font-weight: bold;
}

.action-button {
    padding: 5px 10px;
    font-size: 0.9em;
}

/* Home page cards */
.home-card {
    display: block;
    padding: 30px 20px;
    background: var(--secondary-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    min-width: 200px;
    max-width: 280px;
}

.home-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(9, 67, 98, 0.15);
    transform: translateY(-2px);
}

.home-card h3 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

.home-card p {
    margin: 0;
    font-size: 0.95em;
    color: #666;
}

/* Keep hamburger visible and use dropdown menu from top-right on all sizes */
@media (min-width: 768px) {
    /* On wider screens we still use the dropdown hamburger - ensure nav remains absolute dropdown */
    .nav-menu {
        position: absolute;
        top: 60px;
        right: 0;
        display: block;
        width: 220px;
        box-shadow: 0 6px 12px rgba(0,0,0,0.15);
        transform: translateX(100%);
    }

    /* Ensure the initial hidden class hides visually for small screens while still available */
    .nav-menu.hidden {
        display: none;
    }

    /* Keep hamburger visible on desktop as requested */
    .hamburger-menu {
        display: block;
    }
}