:root {
    --primary-gradient: linear-gradient(135deg, #0062ff 0%, #0031b3 100%);
    --secondary-gradient: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --text-main: #2d3436;
    --text-muted: #636e72;
    --success-color: #00b894;
    --danger-color: #d63031;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Sarabun', sans-serif;
}

body {
    background: #f0f2f5;
    background-image: radial-gradient(#0062ff11 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* Navbar Modern */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-brand {
    font-weight: 800;
    font-size: 1.4rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-center {
    display: block;
    margin: 0 auto 20px auto;
    height: 100px;
    width: auto;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    margin-left: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    padding: 8px 16px;
    border-radius: 8px;
}

.nav-links a:hover {
    background: #f0f7ff;
    color: #0062ff;
}

/* Header Section */
header {
    background: var(--primary-gradient);
    color: white;
    padding: 40px 0;
    text-align: center;
    clip-path: ellipse(150% 100% at 50% 0%);
    margin-bottom: -30px;
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
    animation: fadeInUp 0.8s ease;
}

header.compact {
    padding: 20px 0;
    clip-path: none;
    margin-bottom: 20px;
}

header.compact h1 {
    font-size: 1.5rem;
}

header.compact .logo-center {
    height: 60px;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease;
}

/* Card Modern */
.card {
    background: var(--glass-bg);
    border-radius: 20px;
    padding: 40px;
    margin-top: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.3);
    animation: slideInUp 0.6s ease-out;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

input[type="text"], 
input[type="password"], 
input[type="number"],
select, 
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ef;
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background: #f8fafc;
}

input:focus, select:focus {
    outline: none;
    border-color: #0062ff;
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 98, 255, 0.1);
}

input.is-invalid {
    border-color: var(--danger-color) !important;
    background-color: rgba(214, 48, 49, 0.05) !important;
}

.invalid-feedback {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}

input.is-invalid + .invalid-feedback {
    display: block;
}

/* Buttons */
button, .btn {
    background: var(--primary-gradient);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

button:hover, .btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 98, 255, 0.3);
}

.btn-success { background: var(--success-color); }
.btn-danger { background: var(--danger-color); }

/* Grid System */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

/* Live Feed Styles */
.live-feed-container {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-main);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 98, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    height: 220px; /* ความสูงคงที่สำหรับ 3-4 แถว */
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.live-feed-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 98, 255, 0.1);
}

.live-feed-content {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 10px;
}

/* Minimalist Scrollbar */
.live-feed-content::-webkit-scrollbar {
    width: 4px;
}

.live-feed-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

.live-feed-content::-webkit-scrollbar-thumb {
    background: rgba(0, 98, 255, 0.2);
    border-radius: 10px;
}

.live-feed-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 98, 255, 0.4);
}

.live-feed-container h3 {
    font-weight: 800;
}

.live-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 98, 255, 0.05);
    font-size: 0.85rem;
    animation: fadeInRight 0.5s ease;
}

.live-item:last-child { border-bottom: none; }

.progress-container {
    width: 100%;
    background: #eee;
    border-radius: 10px;
    height: 8px;
    margin-top: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 1s ease-in-out;
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer */
footer {
    background: #1a1c23;
    color: #a0aec0;
    text-align: center;
    padding: 60px 0;
    margin-top: 80px;
}

footer p { margin-bottom: 10px; }

/* Responsive */
@media (max-width: 768px) {
    header { padding: 30px 0; }
    header h1 { font-size: 1.6rem; }
    header p { font-size: 1rem; }
    .logo-center { height: 70px; }
    
    .container { width: 95%; padding: 10px; }
    .card { padding: 20px; }
    
    .navbar .container {
        flex-direction: column;
        text-align: center;
    }
    
    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        margin-top: 5px;
    }
    
    .nav-links a {
        margin-left: 0;
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .nav-brand { font-size: 1.1rem; }
    .logo-img { height: 30px; }
}
