/* CSS Variables */
:root {
    --primary-color: #C43A3A;
    --primary-light: #e85555;
    --primary-dark: #a02d2d;
    --background: #f8f9fa;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

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

body {
    font-family: 'Kanit', 'Sarabun', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    display: flex;
    min-height: 100vh;
}

.container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #8B2635 0%, #6B1E2A 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-240px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    max-height: 50px;
    filter: brightness(0) invert(1);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 5px;
}

.sidebar-toggle span {
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-section-title {
    padding: 0 20px 10px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.5);
}

.nav-item.active .nav-link {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
}

.nav-icon {
    font-size: 18px;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .language-controls {
    margin-bottom: 15px;
    justify-content: center;
}

.sidebar-footer .btn-language {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    font-size: 12px;
}

.sidebar-footer .btn-language.active {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

.sidebar-footer .btn-language:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 20px;
    transition: margin-left 0.3s ease;
    max-width: calc(100% - 280px);
}

.main-content.expanded {
    margin-left: 40px;
    max-width: calc(100% - 40px);
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--primary-color);
    margin-right: 15px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.menu-toggle:hover {
    background-color: rgba(196, 58, 58, 0.1);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid var(--primary-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    max-height: 60px;
}

h1 {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 2rem;
    margin: 0;
}

.language-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Dashboard */
.dashboard {
    margin-bottom: 30px;
}

.dashboard h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: var(--card-background);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.dashboard-card h3 {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 10px;
    line-height: 1.3;
}

.dashboard-card .member-count {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 10px 0;
}

.dashboard-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.search-box input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    width: 300px;
    font-family: 'Kanit', sans-serif;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kanit', sans-serif;
}

.btn-language {
    padding: 8px 16px;
    background-color: #f8f9fa;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    margin: 0 2px;
}

.btn-language.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-language:hover {
    background-color: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

.copy-btn {
    background-color: #28a745;
    color: white;
    margin-left: 8px;
}

.copy-btn:hover {
    background-color: #218838;
}

/* Profiles Container */
.profiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

/* Profile Card */
.profile-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.profile-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.name-section {
    margin-bottom: 15px;
}

.name-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.name-label {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 60px;
    font-size: 14px;
}

.name-value {
    flex: 1;
    font-size: 16px;
    margin-right: 10px;
}

.chinese-text {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', 'SimHei', sans-serif;
}

.case-toggle {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
}

.case-toggle:hover {
    background-color: var(--primary-color);
    color: white;
}

.profile-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    margin-bottom: 15px;
}

.photo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    margin-bottom: 15px;
    border: 3px solid var(--border-color);
}

.education-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.education-item {
    margin-bottom: 10px;
    padding: 10px;
    background-color: var(--background);
    border-radius: 4px;
}

.education-level {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

.education-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Language Content */
.lang-th, .lang-en, .lang-cn {
    display: none;
}

.lang-th.active, .lang-en.active, .lang-cn.active {
    display: inline;
}

.lang-content {
    display: none;
}

.lang-content.active {
    display: block;
}

/* Position Entries */
.position-entry {
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.position-header label {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
    margin: 0;
}

.position-row {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.position-row select,
.position-row input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Kanit', sans-serif;
}

.position-remove-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.position-remove-btn:hover {
    background-color: #c82333;
}

.position-item {
    margin-bottom: 8px;
    padding: 8px;
    background-color: var(--background);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.position-item:last-child {
    margin-bottom: 0;
}

/* Form Sections */
.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.form-section h3 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
}

/* Education Level Row */
.education-level-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.education-level-row select {
    flex: 2;
    min-width: 200px;
}

.education-level-row input {
    flex: 1;
    min-width: 100px;
}

.year-separator {
    font-weight: bold;
    color: var(--text-secondary);
}

/* Center "No profiles found" message */
.no-profiles-message {
    text-align: center;
    color: #666;
    font-size: 18px;
    margin-top: 50px;
    padding: 40px;
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.profile-info {
    display: grid;
    gap: 12px;
}

.info-row {
    display: flex;
    align-items: flex-start;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 120px;
    font-size: 14px;
}

.info-value {
    flex: 1;
    font-size: 14px;
}

.nickname {
    font-style: italic;
    color: var(--primary-color);
}

.age {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--card-background);
    margin: 3% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover {
    color: var(--primary-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-280px);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 15px;
    }
    
    .main-content.expanded {
        margin-left: 0;
        max-width: 100%;
    }
    
    .header-left {
        gap: 10px;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .dashboard-card h3 {
        font-size: 0.9rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .profiles-container {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-height: 90vh;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .sidebar-footer .language-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .sidebar-footer .btn-language {
        width: 100%;
    }
}

/* Success/Error Messages */
.message {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}