/* style.css - Camp Jupiter Theme */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
    /* --- Roman Theme Colors --- */
    --primary-color: #6a0dad; /* สีม่วงโรมัน (Roman Purple) */
    --secondary-color: #ffd700; /* สีทอง (Gold) */
    --background-color: #f5f2f8; /* สีพื้นหลังโทนอ่อน */
    --text-color: #333;
    --card-bg: #ffffff;
    --border-color: #dcd1e8;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --header-bg: #2d0b45; /* สีม่วงเข้มสำหรับ Header */

    /* --- Reward Tag Colors --- */
    --reward-exp-bg: #d4edda; /* Soft Green */
    --reward-exp-text: #155724;
    --reward-int-bg: #d1ecf1; /* Sky Blue */
    --reward-int-text: #0c5460;
    --reward-drachma-bg: #fff3cd; /* Warm Gold (for Denarii) */
    --reward-drachma-text: #856404;
    --reward-honor-bg: #e2e3e5; /* Medium Grey */
    --reward-honor-text: #383d41;
    --reward-item-bg: #e8dcd5; /* Light Brown/Stone for Items */
    --reward-item-text: #5e4a3e;
    --reward-default-bg: #f8f9fa; 
    --reward-default-text: #495057;

    /* --- Roman God Favor Specific Colors --- */
    --reward-favor-pluto-bg: #1a1a1a; /* Black for Pluto */
    --reward-favor-pluto-text: #e0e0e0;
    --reward-favor-mars-bg: #9b2226; /* Deep Red for Mars */
    --reward-favor-mars-text: #ffffff;
    --reward-favor-victoria-bg: #ffc107; /* Gold for Victoria */
    --reward-favor-victoria-text: #212529;
    --reward-favor-proserpina-bg: #c9184a; /* Pomegranate Red for Proserpina */
    --reward-favor-proserpina-text: #ffffff;
    --reward-favor-diana-bg: #adb5bd; /* Silver for Diana */
    --reward-favor-diana-text: #212529;
    --reward-favor-vulcan-bg: #e67e22; /* Burnt Orange/Bronze for Vulcan */
    --reward-favor-vulcan-text: #ffffff;
    --reward-favor-apollo-bg: #f1c40f; /* Bright Gold for Apollo */
    --reward-favor-apollo-text: #333;
    --reward-favor-minerva-bg: #007bff; /* Royal Blue for Minerva */
    --reward-favor-minerva-text: #ffffff;
    --reward-favor-bacchus-bg: #5a189a; /* Dark Purple for Bacchus */
    --reward-favor-bacchus-text: #ffffff;
    --reward-favor-venus-bg: #f5c6d0; /* Soft Pink for Venus */
    --reward-favor-venus-text: #8e24aa;
    --reward-favor-trivia-bg: #495057; /* Dark Grey/Silver for Trivia */
    --reward-favor-trivia-text: #ffffff;
    --reward-favor-default-bg: #a879d4; /* Light Purple for general Favor */
    --reward-favor-default-text: #ffffff; 
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    background-image: url('https://www.transparenttextures.com/patterns/concrete-wall.png');
    line-height: 1.7;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.main-header {
    background: var(--header-bg);
    color: var(--secondary-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 5px solid var(--secondary-color);
    box-shadow: 0 4px 15px var(--shadow-color);
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    height: 60px;
    width: auto; /* Adjust for non-square logos */
    margin-right: 1rem;
}

.main-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    padding-bottom: 5px;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.main-nav a:hover {
    color: var(--secondary-color);
}
.main-nav a:hover::after {
    width: 100%;
}


/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 3rem;
    color: var(--primary-color);
    font-weight: 700;
    text-shadow: 1px 1px 2px var(--shadow-color);
}
.page-header .btn {
    margin-top: 1rem;
}

/* Quest Board */
.quest-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2.5rem;
}

.quest-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    box-shadow: 0 10px 25px var(--shadow-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.quest-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(106, 13, 173, 0.2);
}

.quest-card.expired {
    opacity: 0.6;
    background: #e9ecef;
}
.quest-card.expired .quest-header {
    background: #6c757d;
}

.quest-header {
    background: linear-gradient(135deg, var(--header-bg), var(--primary-color));
    color: white;
    padding: 1.5rem;
    position: relative;
}
.quest-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}
.quest-header .quest-duration {
    font-size: 0.9rem;
    opacity: 0.9;
}
.quest-type-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--secondary-color);
    color: var(--header-bg);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.quest-taker-info {
    background-color: var(--secondary-color);
    color: var(--header-bg);
    text-align: center;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
}
.quest-taker-info strong {
    color: var(--primary-color);
}

.quest-body {
    padding: 1.5rem;
    flex-grow: 1;
}
.quest-body h3 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.quest-conditions {
    margin-bottom: 1.5rem;
}
.quest-conditions ul {
    list-style: none;
    padding-left: 0;
    margin-top: 0.5rem;
}
.quest-conditions li {
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-radius: 5px;
    margin-bottom: 5px;
    border-left: 4px solid var(--primary-color);
    font-size: 0.95rem;
}

.quest-body .description {
    margin-bottom: 1.5rem;
}

.content-section ol {
    list-style: none;
    counter-reset: step-counter;
    padding-left: 0;
}
.content-section li {
    counter-increment: step-counter;
    margin-bottom: 1rem;
    position: relative;
    padding-left: 40px;
}
.content-section li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

.rewards-section {
    margin-top: 1.5rem;
}

.content-tabs, .rewards-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}
.content-tabs button, .rewards-tabs button {
    background: none;
    border: none;
    padding: 10px 20px;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}
.content-tabs button.active, .rewards-tabs button.active {
    opacity: 1;
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.rewards-content ul {
    list-style: none;
    padding-left: 0;
}
.rewards-content li {
    padding: 5px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.rewards-content strong {
    color: var(--primary-color);
    margin-right: 10px;
    white-space: nowrap;
}

.reward-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.reward-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.reward-tag:hover {
    transform: translateY(-2px);
}

.reward-tag-exp { background-color: var(--reward-exp-bg); color: var(--reward-exp-text); }
.reward-tag-int { background-color: var(--reward-int-bg); color: var(--reward-int-text); }
.reward-tag-drachma { background-color: var(--reward-drachma-bg); color: var(--reward-drachma-text); }
.reward-tag-honor { background-color: var(--reward-honor-bg); color: var(--reward-honor-text); }
.reward-tag-item { background-color: var(--reward-item-bg); color: var(--reward-item-text); }
.reward-tag-favor-pluto { background-color: var(--reward-favor-pluto-bg); color: var(--reward-favor-pluto-text); }
.reward-tag-favor-mars { background-color: var(--reward-favor-mars-bg); color: var(--reward-favor-mars-text); }
.reward-tag-favor-victoria { background-color: var(--reward-favor-victoria-bg); color: var(--reward-favor-victoria-text); }
.reward-tag-favor-proserpina { background-color: var(--reward-favor-proserpina-bg); color: var(--reward-favor-proserpina-text); }
.reward-tag-favor-diana { background-color: var(--reward-favor-diana-bg); color: var(--reward-favor-diana-text); }
.reward-tag-favor-vulcan { background-color: var(--reward-favor-vulcan-bg); color: var(--reward-favor-vulcan-text); }
.reward-tag-favor-apollo { background-color: var(--reward-favor-apollo-bg); color: var(--reward-favor-apollo-text); }
.reward-tag-favor-minerva { background-color: var(--reward-favor-minerva-bg); color: var(--reward-favor-minerva-text); }
.reward-tag-favor-bacchus { background-color: var(--reward-favor-bacchus-bg); color: var(--reward-favor-bacchus-text); }
.reward-tag-favor-venus { background-color: var(--reward-favor-venus-bg); color: var(--reward-favor-venus-text); }
.reward-tag-favor-trivia { background-color: var(--reward-favor-trivia-bg); color: var(--reward-favor-trivia-text); }
.reward-tag-favor { background-color: var(--reward-favor-default-bg); color: var(--reward-favor-default-text); }
.reward-tag-default { background-color: var(--reward-default-bg); color: var(--reward-default-text); }


/* Buttons */
.btn {
    display: inline-block;
    background: linear-gradient(145deg, var(--primary-color), #8e44ad);
    color: #fff !important;
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(106, 13, 173, 0.4);
}
.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(106, 13, 173, 0.6);
}
.btn-secondary {
    background: linear-gradient(145deg, #848484, #505050);
    box-shadow: 0 4px 15px rgba(100, 100, 100, 0.4);
}
.btn-secondary:hover {
    box-shadow: 0 7px 20px rgba(100, 100, 100, 0.6);
}
.btn-danger {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}
.btn-danger:hover {
    box-shadow: 0 7px 20px rgba(231, 76, 60, 0.6);
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}
.login-box {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow-color);
    width: 100%;
    max-width: 450px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.logo-login {
    width: 120px;
    height: auto;
    margin-bottom: 1.5rem;
}
.login-box h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}
.login-box p {
    margin-bottom: 2rem;
    color: #666;
}
.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}
.input-group input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.3);
}
.login-box .btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    margin-top: 1rem;
}
.error-banner {
    background-color: #e74c3c;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}


/* Admin Page */
.admin-section {
    background: var(--card-bg);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px var(--shadow-color);
    border: 1px solid var(--border-color);
}
.admin-section h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--secondary-color);
}
.quest-list-table {
    width: 100%;
    border-collapse: collapse;
}
.quest-list-table th, .quest-list-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.quest-list-table th {
    font-weight: 600;
    color: var(--primary-color);
}
.quest-list-table tr:last-child td {
    border-bottom: none;
}
.quest-list-table tr:hover {
    background-color: #f8f5fc;
}
.quest-list-table input[type="text"], .quest-list-table input[type="date"] {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}
.actions .btn {
    padding: 0.4rem 0.8rem;
    margin: 0 2px;
    font-size: 0.9rem;
}

.choice-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}
.choice-toggle-label {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--primary-color);
}


/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary-color);
}
input:focus + .slider {
  box-shadow: 0 0 1px var(--primary-color);
}
input:checked + .slider:before {
  transform: translateX(26px);
}

/* Admin Form */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    font-family: 'Kanit', sans-serif;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: #fff;
}
.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

#content-rows-container .content-row,
#alt-content-rows-container .content-row {
    background: #f8f5fc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #e9e0f0;
}

.content-row textarea {
    min-height: 150px !important;
}

.content-row .links-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.link-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#rewards-choice-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

#alt-rewards, #alt-content-section {
    display: none;
    background-color: #f3eef7;
    padding: 1.5rem;
    border-radius: 10px;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}
#alt-rewards h3, #alt-content-section h3 {
    color: var(--primary-color);
    border-bottom: 1px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.full-width {
    grid-column: 1 / -1;
}

.success-message {
    background-color: #2ecc71;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
}

@media (max-width: 992px) {
    .quest-board {
        grid-template-columns: 1fr;
    }
    .form-grid, #rewards-choice-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        text-align: center;
    }
    .main-header h1 {
        margin-bottom: 1rem;
    }
    .main-nav {
        margin-top: 1rem;
    }
    .main-nav a {
        margin: 0 0.5rem;
    }
}
