/* PHY Member Portal — Modern UI */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --phy-primary: #1a7fc1;
    --phy-primary-dark: #1565a0;
    --phy-primary-light: #e8f4fc;
    --phy-accent: #0d9488;
    --phy-danger: #dc2626;
    --phy-success: #16a34a;
    --phy-warning: #d97706;
    --phy-bg: #f0f4f8;
    --phy-card: #ffffff;
    --phy-text: #1e293b;
    --phy-text-muted: #64748b;
    --phy-border: #e2e8f0;
    --phy-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --phy-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
    --phy-radius: 12px;
    --phy-radius-sm: 8px;
    --phy-header-h: 88px;
    --phy-sidebar-w: 220px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Sarabun', Tahoma, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--phy-text);
    background: var(--phy-bg);
    -webkit-font-smoothing: antialiased;
}

body.phy-login {
    background: linear-gradient(135deg, #0c4a6e 0%, var(--phy-primary) 45%, var(--phy-accent) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.phy-login-wrap { width: 100%; max-width: 440px; }

.phy-login-card {
    background: var(--phy-card);
    border-radius: var(--phy-radius);
    box-shadow: var(--phy-shadow-lg);
    overflow: hidden;
}

.phy-login-brand {
    background: linear-gradient(135deg, var(--phy-primary-dark), var(--phy-primary));
    padding: 28px 24px;
    text-align: center;
    color: #fff;
}

.phy-login-brand img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}

.phy-login-brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.4;
}

.phy-login-brand p { font-size: 0.85rem; opacity: 0.9; margin: 0; }

.phy-login-body { padding: 28px 28px 24px; }

.phy-login-body h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--phy-primary);
    text-align: center;
    margin: 0 0 20px;
}

.phy-form-group { margin-bottom: 16px; }

.phy-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.phy-form-group input[type="text"],
.phy-form-group input[type="password"],
.phy-form-group input[type="email"],
.phy-form-group input[type="date"],
.phy-form-group select,
.phy-form-group textarea,
.inputs,
.text-input {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    border: 1px solid var(--phy-border);
    border-radius: var(--phy-radius-sm);
    background: #fff;
    color: var(--phy-text);
    transition: border-color .2s, box-shadow .2s;
}

.phy-form-group input:focus,
.inputs:focus,
.text-input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--phy-primary);
    box-shadow: 0 0 0 3px rgba(26, 127, 193, 0.15);
}

.phy-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--phy-text-muted);
    margin-bottom: 20px;
}

.phy-btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.phy-login-links {
    text-align: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--phy-border);
}

.phy-login-links a {
    color: var(--phy-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.phy-login-links a:hover { text-decoration: underline; }

.phy-login-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255,255,255,.85);
    font-size: 0.8rem;
    line-height: 1.5;
}

.phy-login-footer a { color: #fff; }

body.phy-app { background: var(--phy-bg); min-height: 100vh; }

.phy-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--phy-card);
    box-shadow: var(--phy-shadow-lg);
}

.phy-header {
    background: linear-gradient(135deg, var(--phy-primary-dark), var(--phy-primary));
    color: #fff;
    padding: 0 20px;
    min-height: var(--phy-header-h);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.phy-header img { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }

.phy-header-text h1 { font-size: 1.2rem; font-weight: 700; margin: 0; line-height: 1.3; }
.phy-header-text p { font-size: 0.85rem; margin: 2px 0 0; opacity: 0.9; }

.phy-body { display: flex; flex: 1; min-height: 0; }

.phy-sidebar {
    width: var(--phy-sidebar-w);
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid var(--phy-border);
    padding: 12px 0;
    overflow-y: auto;
}

.phy-nav { list-style: none; margin: 0; padding: 0; }

.phy-nav li a {
    display: block;
    padding: 11px 18px;
    color: var(--phy-text) !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: background .15s, border-color .15s, color .15s;
}

.phy-nav li a:hover {
    background: var(--phy-primary-light);
    color: var(--phy-primary) !important;
    border-left-color: var(--phy-primary);
}

.phy-nav li.phy-nav-active a {
    background: var(--phy-primary-light);
    color: var(--phy-primary-dark) !important;
    border-left-color: var(--phy-primary);
    font-weight: 600;
}

.phy-nav li.phy-nav-logout a {
    color: var(--phy-danger) !important;
    margin-top: 8px;
    border-top: 1px solid var(--phy-border);
    padding-top: 14px;
}

.phy-nav li.phy-nav-logout a:hover {
    background: #fef2f2;
    border-left-color: var(--phy-danger);
}

.phy-content { flex: 1; padding: 20px 24px 28px; overflow-x: auto; min-width: 0; }

.phy-footer {
    background: linear-gradient(135deg, #1e3a5f, var(--phy-primary-dark));
    color: rgba(255,255,255,.9);
    text-align: center;
    padding: 16px 20px;
    font-size: 0.8rem;
    line-height: 1.6;
    flex-shrink: 0;
}

.phy-footer strong { color: #fff; }
.phy-footer a { color: #bfdbfe; text-decoration: none; }
.phy-footer a:hover { text-decoration: underline; }

.phy-content table { border-collapse: collapse; width: 100%; }
.phy-content > table, .phy-content .class2 > table { margin-bottom: 16px; }

.phy-content font[color="#FF6600"],
.phy-content font[color="#ff6600"] {
    color: var(--phy-text-muted) !important;
    font-size: 0.8rem !important;
}

.phy-content font[size="4"] strong,
.phy-content strong { font-size: 1.1rem; color: var(--phy-primary-dark); }

.phy-content hr { border: none; border-top: 1px solid var(--phy-border); margin: 8px 0 16px; }

.phy-content table[border="1"] th,
.phy-content table[border="1"] tr[bgcolor] td {
    background: var(--phy-primary-light);
    font-weight: 600;
    padding: 8px 10px;
}

.phy-content table[border="1"] td,
.phy-content table[border="1"] th { border: 1px solid var(--phy-border); padding: 7px 10px; }
.phy-content table[border="1"] tr:nth-child(even) td { background: #f8fafc; }

.button1, .addnews,
input[type="submit"].button1,
input[type="button"].button1 {
    background: var(--phy-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--phy-radius-sm) !important;
    padding: 10px 20px !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    height: auto !important;
    line-height: 1.4 !important;
    width: auto !important;
    min-width: 120px;
    transition: background .2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.button1:hover, .addnews:hover { background: var(--phy-primary-dark) !important; color: #fff !important; }

.button2, input[type="reset"].button2, input[type="button"].button2 {
    background: #f1f5f9 !important;
    color: var(--phy-text) !important;
    border: 1px solid var(--phy-border) !important;
    border-radius: var(--phy-radius-sm) !important;
    padding: 10px 20px !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    cursor: pointer;
    height: auto !important;
    line-height: 1.4 !important;
    width: auto !important;
    min-width: 80px;
}

.button2:hover { background: #e2e8f0 !important; }
.button3 { background: var(--phy-danger) !important; border-radius: var(--phy-radius-sm) !important; border: none !important; color: #fff !important; padding: 8px 16px !important; height: auto !important; width: auto !important; }
.button4 { background: var(--phy-text) !important; border-radius: var(--phy-radius-sm) !important; border: none !important; color: #fff !important; padding: 8px 16px !important; height: auto !important; width: auto !important; }

.class2 a:link, .class2 a:visited { color: var(--phy-primary); }
.class2 a:hover { color: var(--phy-primary-dark); }

body.phy-page { background: var(--phy-bg); min-height: 100vh; }

.phy-page-shell {
    max-width: 960px;
    margin: 0 auto;
    background: var(--phy-card);
    min-height: 100vh;
    box-shadow: var(--phy-shadow-lg);
    display: flex;
    flex-direction: column;
}

.phy-page-content { flex: 1; padding: 24px 28px 32px; }

.phy-page-content .formular { border: none; padding: 0; width: 100%; max-width: 640px; margin: 0 auto; }
.phy-page-content .formular fieldset { border: 1px solid var(--phy-border); border-radius: var(--phy-radius); background: #f8fafc; }

.phy-page-content textarea[readonly] {
    border: 1px solid var(--phy-border);
    border-radius: var(--phy-radius-sm);
    padding: 16px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.7;
    background: #f8fafc;
    color: var(--phy-text);
}

body.phy-mobile { background: var(--phy-bg); font-family: 'Sarabun', Tahoma, sans-serif; }

.phy-mobile-header {
    background: linear-gradient(135deg, var(--phy-primary-dark), var(--phy-primary));
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--phy-shadow);
}

.phy-mobile-header h1 { font-size: 1rem; font-weight: 600; margin: 0; }

.phy-mobile-menu-btn {
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: var(--phy-radius-sm);
    font-size: 1.2rem;
    cursor: pointer;
}

.phy-mobile-nav { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); z-index: 200; }
.phy-mobile-nav.open { display: block; }

.phy-mobile-nav-panel {
    background: var(--phy-card);
    width: 280px;
    max-width: 85vw;
    height: 100%;
    overflow-y: auto;
    padding: 16px 0;
    box-shadow: var(--phy-shadow-lg);
}

.phy-mobile-nav-panel a {
    display: block;
    padding: 12px 20px;
    color: var(--phy-text);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--phy-border);
}

.phy-mobile-nav-panel a:hover { background: var(--phy-primary-light); color: var(--phy-primary); }

.phy-mobile-content { padding: 16px; max-width: 640px; margin: 0 auto; }
.phy-mobile-login { max-width: 400px; margin: 40px auto; padding: 0 16px; }
.phy-mobile-footer { text-align: center; padding: 16px; font-size: 0.75rem; color: var(--phy-text-muted); }

body.phy-wb { background: var(--phy-bg); font-family: 'Sarabun', Tahoma, sans-serif; }

.phy-wb-shell {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--phy-card);
    min-height: 100vh;
    box-shadow: var(--phy-shadow-lg);
}

.phy-wb-header {
    background: linear-gradient(135deg, var(--phy-primary-dark), var(--phy-primary));
    color: #fff;
    padding: 20px 24px;
    text-align: center;
}

.phy-wb-header h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }

.phy-wb-nav {
    display: flex;
    flex-wrap: wrap;
    background: #f1f5f9;
    border-bottom: 1px solid var(--phy-border);
}

.phy-wb-nav a {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 12px 16px;
    color: var(--phy-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-right: 1px solid var(--phy-border);
}

.phy-wb-nav a:hover { background: var(--phy-primary-light); color: var(--phy-primary); }

.phy-wb-welcome {
    flex: 2;
    text-align: center;
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--phy-text-muted);
    border-right: 1px solid var(--phy-border);
}

.phy-wb-content { padding: 20px 24px 32px; }
.phy-wb-content .table thead th { background: var(--phy-primary); color: #fff; font-weight: 600; border: none; }

.phy-wb-actions { margin-bottom: 16px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.phy-wb-actions a { color: var(--phy-primary); font-weight: 500; text-decoration: none; }
.phy-wb-actions a:hover { text-decoration: underline; }

.phy-page-content table[bordercolor] {
    border: 1px solid #fecaca;
    border-radius: var(--phy-radius-sm);
    background: #fff5f5;
    padding: 16px;
    margin-bottom: 20px;
}

.phy-page-content input[type="submit"],
.phy-page-content input[type="reset"],
.phy-page-content input[type="button"] {
    border-radius: var(--phy-radius-sm);
    padding: 8px 16px;
    font-family: inherit;
    cursor: pointer;
}

.phy-content table[bgcolor="#666666"] td,
.phy-content tr[bgcolor="#666666"] td {
    background: var(--phy-primary) !important;
    color: #fff !important;
    border-radius: var(--phy-radius-sm) var(--phy-radius-sm) 0 0;
}

.phy-content table[bgcolor="#666666"] font,
.phy-content tr[bgcolor="#666666"] font { color: #fff !important; }

@media (max-width: 768px) {
    .phy-body { flex-direction: column; }
    .phy-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--phy-border); }
    .phy-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px; }
    .phy-nav li { flex: 1 1 auto; min-width: 140px; }
    .phy-nav li a { border-left: none; border-radius: var(--phy-radius-sm); padding: 10px 12px; text-align: center; font-size: 0.82rem; }
    .phy-header { padding: 12px 16px; }
    .phy-header img { width: 48px; height: 48px; }
    .phy-header-text h1 { font-size: 1rem; }
    .phy-content { padding: 16px; }
    .phy-wb-nav { flex-direction: column; }
    .phy-wb-nav a, .phy-wb-welcome { border-right: none; border-bottom: 1px solid var(--phy-border); }
}

@media print {
    .phy-sidebar, .phy-header, .phy-footer, .phy-mobile-header, .phy-wb-nav { display: none !important; }
    .phy-shell, .phy-page-shell { box-shadow: none; max-width: 100%; }
    body { background: #fff; }
}
