/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Poppins', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    color: #ffffff;
    position: relative;
    overflow-x: hidden;
}

/* ============================================
   BACKGROUND WRAPPER
   ============================================ */
.background-wrapper {
    min-height: 100vh;
    width: 100%;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
}

.background-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    background-attachment: fixed;
    filter: brightness(0.4);
    z-index: -2;
}

/* ============================================
   GLASS MORPHISM
   ============================================ */
.glass-card {
    background: rgba(20, 25, 35, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.6s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
    transform: translateY(-5px);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    background: rgba(15, 20, 30, 0.9) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030 !important;
}

.navbar-brand {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.navbar-brand i {
    color: #4CAF50;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    margin: 0 4px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.navbar-nav .nav-link.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #ffffff !important;
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-menu {
    background: rgba(20, 25, 35, 0.98) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 16px !important;
    padding: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    z-index: 1040 !important;
}

.dropdown-item {
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 10px;
    padding: 10px 16px;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    transform: translateX(5px);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    padding: 90px 20px 40px;
    position: relative;
    z-index: 1;
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.form-control {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #667eea;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #fa709a 0%, #f54848 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: white;
}

.btn-outline-light {
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    background: transparent;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 16px;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    color: #ffffff;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    background: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.table-hover tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.bg-success {
    background: linear-gradient(135deg, #43e97b, #38f9d7) !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #fa709a, #f54848) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #f6d365, #fda085) !important;
    color: #000 !important;
}

.badge.bg-info {
    background: linear-gradient(135deg, #4facfe, #00f2fe) !important;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.12);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 10px;
    color: #667eea;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   INFO ROW
   ============================================ */
.info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-label {
    width: 120px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.info-value {
    flex: 1;
    color: #fff;
    font-weight: 500;
}

/* ============================================
   NAV TABS
   ============================================ */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-tabs .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 12px 20px;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-tabs .nav-link.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.2);
    border-bottom: 2px solid #667eea;
}

/* ============================================
   RCON CONSOLE
   ============================================ */
.rcon-console {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 15px;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.rcon-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00ff88;
    color: #00ff88;
    font-family: 'Courier New', monospace;
}

.rcon-input:focus {
    background: rgba(0, 0, 0, 0.7);
    color: #00ff88;
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

/* ============================================
   SERVER INFO
   ============================================ */
.server-ip {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 20px;
    border-radius: 12px;
    color: #00ff88;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    display: inline-block;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 233, 123, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(67, 233, 123, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(67, 233, 123, 0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: rgba(15, 20, 30, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   MODAL STYLES - แก้ไขปัญหาขนาดและการกระตุก
   ============================================ */

/* ปิดการทำงาน animation และ transition ทั้งหมดของ modal */
.modal.fade,
.modal.fade .modal-dialog {
    transition: none !important;
    animation: none !important;
}

.modal.fade .modal-dialog {
    transform: none !important;
}

.modal.show .modal-dialog {
    transform: none !important;
}

/* ตั้งค่าขนาด modal */
.modal {
    --bs-modal-width: auto !important;
}

.modal-dialog {
    max-width: 90vw !important;
    width: auto !important;
    margin: 1.75rem auto !important;
}

.modal-content {
    background: #141c28 !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 20px !important;
    color: #fff !important;
    width: 100% !important;
    max-width: 800px !important;
    margin: 0 auto !important;
}

/* modal ขนาดใหญ่ขึ้น */
.modal-lg .modal-content,
.modal-xl .modal-content {
    max-width: 90vw !important;
}

/* ให้ modal body scroll */
.modal-body {
    overflow-y: auto;
    max-height: 70vh;
    padding: 20px;
}

/* Responsive */
@media (min-width: 768px) {
    .modal-dialog {
        max-width: 85vw !important;
    }
    .modal-content {
        max-width: 100% !important;
    }
}

@media (min-width: 1200px) {
    .modal-dialog {
        max-width: 80vw !important;
    }
}

/* modal กว้างพิเศษ */
.modal-extra-wide .modal-dialog {
    max-width: 95vw !important;
}

.modal-extra-wide .modal-content {
    max-width: 1200px !important;
}

/* ปรับขนาด modal header/footer */
.modal-header, .modal-footer {
    border-color: rgba(255,255,255,0.1) !important;
    padding: 15px 20px !important;
}

.modal-title {
    font-weight: 600;
}

/* ============================================
   MODAL - องค์ประกอบภายใน
   ============================================ */
.modal-content .form-control,
.modal-content .form-select,
.modal-content textarea,
.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content input[type="email"],
.modal-content input[type="password"] {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: #fff !important;
    border-radius: 10px !important;
}

.modal-content .form-control:focus,
.modal-content .form-select:focus,
.modal-content textarea:focus,
.modal-content input:focus {
    background: rgba(255,255,255,0.15) !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.25) !important;
    color: #fff !important;
    outline: none;
}

.modal-content .form-control::placeholder,
.modal-content textarea::placeholder,
.modal-content input::placeholder {
    color: rgba(255,255,255,0.4) !important;
}

.modal-content label {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500 !important;
    margin-bottom: 8px;
}

.modal-content .btn-close {
    filter: invert(1) !important;
    opacity: 0.8;
}

.modal-content .btn-close:hover {
    opacity: 1;
}

.modal-content .btn-secondary {
    background: rgba(255,255,255,0.15) !important;
    border: none !important;
    color: #fff !important;
}

.modal-content .btn-secondary:hover {
    background: rgba(255,255,255,0.25) !important;
}

.modal-content .btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    border: none !important;
}

.modal-content .btn-success {
    background: linear-gradient(135deg, #43e97b, #38f9d7) !important;
    border: none !important;
    color: #000 !important;
}

.modal-content .btn-danger {
    background: linear-gradient(135deg, #fa709a, #f54848) !important;
    border: none !important;
}

.modal-content .btn-outline-secondary {
    border: 1px solid rgba(255,255,255,0.3) !important;
    color: #fff !important;
    background: transparent !important;
}

.modal-content .btn-outline-secondary:hover {
    background: rgba(255,255,255,0.15) !important;
    border-color: rgba(255,255,255,0.5) !important;
}

.modal-content .form-check-input {
    background-color: rgba(255,255,255,0.2) !important;
    border-color: rgba(255,255,255,0.3) !important;
}

.modal-content .form-check-input:checked {
    background-color: #667eea !important;
    border-color: #667eea !important;
}

.modal-content .input-group-text {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: #fff !important;
}

.modal-content .alert {
    background: rgba(0,0,0,0.3) !important;
    border-color: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

.modal-content .alert-info {
    background: rgba(79,172,254,0.15) !important;
    border-color: #4facfe !important;
}

.modal-content .alert-warning {
    background: rgba(246,211,101,0.15) !important;
    border-color: #f6d365 !important;
}

.modal-content .alert-danger {
    background: rgba(250,112,154,0.15) !important;
    border-color: #fa709a !important;
}

.modal-content .alert-success {
    background: rgba(67,233,123,0.15) !important;
    border-color: #43e97b !important;
}

/* ============================================
   SWEETALERT2 - จัดการให้อยู่ด้านบนสุด
   ============================================ */
.swal2-container {
    z-index: 9999 !important;
}

.swal2-popup {
    background: #141c28 !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

.swal2-input, .swal2-textarea, .swal2-select {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: #fff !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, #43e97b, #38f9d7) !important;
    color: #000 !important;
}

.swal2-cancel {
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 20px;
    }
    
    .main-content {
        padding: 80px 15px 30px;
    }
    
    .glass-card {
        padding: 20px;
    }
    
    .btn {
        padding: 8px 20px;
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .modal-dialog {
        margin: 10px !important;
        max-width: calc(100% - 20px) !important;
    }
    
    .modal-content {
        max-width: 100% !important;
    }
    
    .modal-body {
        max-height: 60vh;
        padding: 15px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.cursor-pointer {
    cursor: pointer;
}

.text-gradient {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.opacity-50 {
    opacity: 0.5;
}