/*
Theme Name: TnSEA Custom Responsive Theme (Based on Twenty Ten)
Description: A responsive stylesheet for the Tainan Structural Engineers Association website.
Version: 2025.10.25
*/

/* ==========================================================================
   1. CSS Reset & Basic Setup
   ========================================================================== */

html, body, div, span, h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	background: transparent;
	border: 0;
	margin: 0;
	padding: 0;
	vertical-align: baseline;
	font-size: 100%; /* Use 100% for better responsiveness */
}
body {
	line-height: 1.5; /* Use unitless line-height */
	font-family: "Helvetica Neue", Arial, "微軟正黑體", "Microsoft JhengHei", sans-serif; /* Prioritize sans-serif */
	background: #f1f1f1;
	color: #333;
	font-size: 16px; /* Base font size */
}
h1, h2, h3, h4, h5, h6 {
	clear: both;
	font-weight: normal;
    line-height: 1.3;
    margin-bottom: 0.8em;
}
h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
ol, ul {
	list-style: none; /* Remove default list style */
    padding-left: 0; /* Remove default padding */
}
table {
	border-collapse: collapse;
	border-spacing: 0;
    width: 100%; /* Make tables responsive by default */
}
a img {
	border: none;
}
a:link {
	color: #0066cc;
    text-decoration: none;
}
a:visited {
	color: #743399;
}
a:active,
a:hover {
	color: #ff4b33;
}

/* Make images responsive */
img {
    max-width: 100%;
    height: auto;
    display: block; /* Remove extra space below images */
}

/* Basic form element styling */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
	background: #f9f9f9;
	border: 1px solid #ccc;
	box-shadow: inset 1px 1px 1px rgba(0,0,0,0.1);
	padding: 8px; /* Consistent padding */
    box-sizing: border-box; /* Include padding in width */
    width: 100%; /* Make form elements take full width by default */
    max-width: 400px; /* Limit max width for readability */
    margin-bottom: 10px;
}
input[type="checkbox"],
input[type="radio"] {
    width: auto; /* Checkboxes don't need full width */
    margin-right: 5px;
}
button, input[type="submit"] {
    padding: 10px 15px;
    font-size: 1em;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
}
button:hover, input[type="submit"]:hover {
    background-color: #0056b3;
}

/* ==========================================================================
   2. Main Layout Structure
   ========================================================================== */

#wrapper {
	width: auto; /* Fluid width */
	max-width: 1489px; /* Max width */
	margin: 20px auto; /* Centering */
	background: #fff;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 0 15px; /* Consistent padding inside wrapper */
    box-sizing: border-box;
}

/* Ensure header, main, footer take full width within wrapper */
#header,
#main,
#footer {
	width: 100%;
    clear: both; /* Ensure proper clearing */
}

/* Header specific padding */
#header {
	padding-top: 20px; /* Reduced top padding */
}

/* Main content specific padding */
#main {
	padding-top: 20px;
	padding-bottom: 30px;
}

/* Footer specific padding and border */
#footer {
	margin-bottom: 20px;
}
#colophon {
	border-top: 4px solid #000;
	padding-top: 18px;
    padding-bottom: 18px;
	overflow: hidden; /* Contains floated elements if any */
}

/* Remove unnecessary layout styles */
/* #container, #primary, #secondary, .one-column, .single-attachment etc. removed */


/* ==========================================================================
   3. Header (#header)
   ========================================================================== */

/* style.css (修正後) */

/* --- 修改點 1：為 #branding 加入 overflow: hidden 清除內部浮動 --- */
#branding {
    overflow: hidden; /* 包含內部的浮動元素 */
    padding-bottom: 15px; /* 可選：增加一點標題和圖片之間的間距 */
}

/* --- 修改點 2：讓 Site title 向左浮動 --- */
#site-title {
	font-size: 28px; 
	line-height: 1.2;
    margin-bottom: 0; /* 移除底部間距，因為現在是浮動 */
	float: left;     /* 向左浮動 */
	width: auto;     /* 寬度由內容決定 */
    max-width: 65%;  /* 設定最大寬度，避免文字太長時擠壓右側 */
}
#site-title a {
	color: #000;
	font-weight: bold;
	text-decoration: none;
}

/* --- 修改點 3：讓 Site description 向右浮動並靠右對齊 --- */
#site-description {
	font-style: italic;
	color: #555; 
    margin-bottom: 0; /* 移除底部間距 */
	float: right;    /* 向右浮動 */
	width: auto;     /* 寬度由內容決定 */
    max-width: 30%;  /* 設定最大寬度 */
    text-align: right; /* 文字靠右對齊 */
    /* 可以微調 line-height 或 margin-top 使其與標題垂直對齊 */
    line-height: 1.2; 
    margin-top: 5px; /* 稍微往下推一點對齊中文 */
}

/* --- 修改點 4：確保圖片在浮動元素下方 --- */
/* Header image */
#branding img {
	border-top: 4px solid #000;
	border-bottom: 1px solid #000;
    margin-top: 15px; /* 增加圖片與上方文字的間距 */
    clear: both;     /* 確保圖片在左右浮動元素的下方 */
}


/* ==========================================================================
   4. Main Navigation Menu (#access)
   ========================================================================== */

#access {
	background: #000;
	display: block;
	width: 100%; /* Full width */
    margin-top: 15px; /* Space above menu */
    clear: both; /* Ensure it's below branding */
}

#access .menu ul {
	display: flex;
	flex-wrap: wrap; /* Allow wrapping on smaller screens */
	justify-content: flex-start; /* Align items to the start */
	padding: 0 5px; /* Small padding inside the menu bar */
	margin: 0;
	list-style: none;
}

#access .menu li {
	margin-right: 5px; /* Space between menu items */
    flex-shrink: 0; /* Prevent items from shrinking too much */
}

#access a {
	color: #aaa;
	display: block;
	line-height: 38px;
	padding: 0 10px; /* Adjust padding as needed */
	text-decoration: none;
    font-size: 14px; /* Adjust font size */
    white-space: nowrap; /* Prevent text wrapping within a link */
}

#access li:hover > a {
	background: #333;
	color: #fff;
}

#access .current_page_item > a {
	color: #fff;
	background-color: #333; /* Highlight current page */
}

/* Remove complex submenu styling if not used */
#access ul ul { display: none; }


/* ==========================================================================
   5. Main Content (#content, .entry-content, etc.)
   ========================================================================== */

#content h1, #content h2, #content h3 {
    margin-bottom: 1em;
}

#content p {
    margin-bottom: 1em;
    line-height: 1.6;
}

#content ul, #content ol {
    margin-bottom: 1em;
    padding-left: 1.5em; /* Add padding for list indentation */
}
#content ul { list-style: disc; }
#content ol { list-style: decimal; }

#content table {
    margin-bottom: 1.5em;
    border: 1px solid #e7e7e7;
}
#content th, #content td {
    border: 1px solid #e7e7e7;
    padding: 8px 10px;
}
#content th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #555;
}

/* Simplify entry styles */
.entry-title {
	font-size: 1.8em;
	font-weight: bold;
    color: #000;
    margin-bottom: 0.5em;
}
.entry-title a {
    color: #000;
    text-decoration: none;
}
.entry-title a:hover {
    color: #ff4b33;
}
.entry-content {
    padding-top: 1em;
}


/* ==========================================================================
   6. Footer (#footer)
   ========================================================================== */

#site-info {
	font-size: 14px;
    line-height: 1.6;
    color: #444;
    float: none; /* Remove float */
    width: auto; /* Auto width */
}
#site-info a {
	color: #000;
	text-decoration: none;
}
/* Removed #site-generator if not used */

/* ==========================================================================
   7. Specific Page Styles (Announcements, Programs etc.)
   ========================================================================== */

/* Add styles previously embedded in PHP files here */

/* For announcements.php & manage_programs.php */
.title-container { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.announcement-title, .program-title { text-decoration: none; color: #333; font-size: 1.1em; display: inline-flex; align-items: center; flex-grow: 1; }
.announcement-title:hover, .program-title:hover { color: #007bff; }
.edit-button, .add-new-button { font-size: 0.9em; text-decoration: none; color: #007bff; border: 1px solid #007bff; padding: 2px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }
.edit-button:hover, .add-new-button:hover { background-color: #007bff; color: #fff; }
.announcement-list { list-style: none; padding: 0; }
.announcement-list li { padding: 10px; border-bottom: 1px solid #eee; }
.announcement-list .meta { font-size: 0.9em; color: #777; margin-top: 5px; }
.pinned-item { background-color: #fffbe6; }
.status-tag { font-size: 0.8em; padding: 2px 6px; border-radius: 4px; margin-left: 8px; font-weight: bold; color: #fff; }
.public-tag { background-color: #007bff; }
.internal-tag { background-color: #17a2b8; }
.confidential-tag { background-color: #dc3545; }

/* For manage_programs.php */
table.program-table { width: 100%; table-layout: auto; border-collapse: collapse; margin-top: 15px; }
.program-table th, .program-table td { border: 1px solid #ddd; padding: 8px; text-align: left; word-wrap: break-word; overflow-wrap: break-word; vertical-align: top; }
.program-table th { background-color: #f2f2f2; white-space: nowrap; }
.program-table th.col-status { width: 100px; } /* Give status header a width */
td.col-last { text-align: center; }
.actions a { white-space: nowrap; display: block; margin-bottom: 8px; margin-right: 0;}
.add-new { margin-bottom: 20px; font-size: 1.2em; }
.status-active { color: green; }
.status-inactive { color: orange; font-weight: bold; }
.needs-review { background-color: #fff3cd; }
.notification { padding: 10px; margin-bottom: 15px; border-radius: 4px; border: 1px solid transparent; }
.notification.success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.notification.error { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }
td.col-desc, td.col-notes { font-size: 0.9em; line-height: 1.4; }
td.col-notes { background-color: #f8f9fa; }
td.col-last .updated-time { font-size: 0.85em; color: #555; display: block; margin-bottom: 10px; }

/* Remove print styles if not needed */
@media print {
	/* Basic print styles - hide menu, buttons etc. */
    #access, .edit-button, .add-new-button, .actions a[onclick], button, input[type="submit"] { display: none !important; }
    #wrapper { width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; border: none !important; }
    body { background: #fff !important; color: #000 !important; font-size: 12pt !important; }
    a { color: #000 !important; text-decoration: underline !important; }
    table, th, td { border: 1px solid #ccc !important; }
    th { background-color: #eee !important; }
}