@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700;800&display=swap');

:root {
    --font-primary: 'Noto Sans Thai', 'Segoe UI', Tahoma, sans-serif;
    --navy: #0A2540;
    --navy-hover: #001229;
    --navy-slate: #1C3B5E;
    --navy-light: #1f4e79;
    --navy-dark: #0F172A;
    --navy-darker: #020617;
    --gold: #D4AF37;
    --gold-hover: #b08d23;
    --gold-light: #F9F5E8;
    --bg-primary: #F8FAFC;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-main: #0A2540;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

[data-theme="dark"] {
    --bg-primary: #020617;
    --bg-sidebar: #0F172A;
    --bg-card: #1C3B5E;
    --text-main: #F9F5E8;
    --text-muted: #94A3B8;
    --border-color: #1f4e79;
    --navy: #D4AF37;
    --navy-light: #b08d23;
    --navy-dark: #0F172A;
    --gold: #0A2540;
    --gold-hover: #001229;
    --gold-light: rgba(10, 37, 64, 0.2);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Header */
.top-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 70px;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="dark"] .top-header {
    background-color: rgba(11, 15, 25, 0.85);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-dark);
    font-weight: bold;
    color: var(--navy);
}

.brand-text {
    font-size: 1.1rem;
    font-weight: 800;
}

.brand-text span {
    color: #D4AF37;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 250px;
    padding: 8px 16px 8px 36px;
    border-radius: 99px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: #D4AF37;
    box-shadow: 0 0 0 3px var(--gold-light);
    width: 300px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
    border-color: #D4AF37;
    background-color: var(--gold-light);
}

/* Sidebar Navigation */
.sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 70px;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    z-index: 90;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.nav-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    margin-top: 24px;
}

.nav-title:first-of-type {
    margin-top: 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background-color: var(--bg-primary);
}

.nav-link.active {
    font-weight: 700;
    border-left: 3px solid #D4AF37;
    border-radius: 0 6px 6px 0;
    background-color: var(--gold-light);
}

/* Content Area */
.content-wrapper {
    margin-left: 320px;
    padding: 100px 3rem 4rem 3rem;
    width: calc(100% - 320px);
}

.content-body {
    max-width: 800px;
    margin: 0 auto;
}

.doc-section {
    padding-top: 80px;
    margin-top: -40px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 3rem;
}

.doc-section:last-of-type {
    border-bottom: none;
}

h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    line-height: 1.25;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-left: 4px solid #D4AF37;
    padding-left: 12px;
}

h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    color: var(--text-main);
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.metadata-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.metadata-item strong {
    font-size: 0.95rem;
    font-weight: 700;
}

/* UI Elements & Blocks */
.step-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.step-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.step-number {
    width: 28px;
    height: 28px;
    background-color: #0A2540;
    color: #D4AF37;
    font-size: 0.85rem;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-box {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    display: flex;
    gap: 12px;
}

.alert-box.warning {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.alert-box.tip {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10B981;
}

.alert-box svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-primary);
    font-weight: 700;
}

/* UI mock/illustration frames */
.ui-frame {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.ui-bar {
    height: 30px;
    background: #E2E8F0;
    display: flex;
    align-items: center;
    padding-left: 12px;
    gap: 6px;
}

[data-theme="dark"] .ui-bar {
    background: #1E293B;
}

.ui-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FF5F56;
}

.ui-dot:nth-child(2) { background: #FFBD2E; }
.ui-dot:nth-child(3) { background: #27C93F; }

.ui-content {
    background-color: var(--bg-card);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

/* Mobile responsive hamburger menu button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Mobile responsive layout */
@media (max-width: 992px) {
    .menu-toggle {
        display: block;
    }

    .top-header {
        padding: 0 1.25rem;
    }

    .search-box input {
        width: 150px;
    }
    
    .search-box input:focus {
        width: 200px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
        width: 100%;
        padding: 90px 1.5rem 3rem 1.5rem;
    }
}
