:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --background-dark: #0f172a;
    --background-panel: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body {
    background-color: var(--background-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 20%);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

/* Login Screen */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background-color: var(--background-dark);
}

.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.login-header i {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Dashboard Layout */
.dashboard-container {
    display: grid;
    grid-template-areas:
        "header header"
        "nav main";
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

/* Header */
.dashboard-header {
    grid-area: header;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
}

.header-content {
    width: 100%;
    max-width: 1400px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    margin: 0;
}

.header-title i {
    color: var(--primary-color);
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.mobile-menu-btn:hover {
    transform: scale(1.1);
    color: var(--text-primary);
}

.mobile-menu-btn.active {
    color: var(--accent-color);
}

/* Navigation Drawer Styles */
.sidebar-drawer {
    grid-area: nav;
    background: var(--background-panel);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.dashboard-nav {
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.drawer-header {
    display: none;
}

.drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 98;
    backdrop-filter: blur(4px);
}

.drawer-overlay.active {
    display: block;
}

.close-drawer-btn {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1rem;
    width: 100%;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.nav-item i {
    width: 20px;
}

/* Main Content */
.dashboard-main {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
}

.content-section {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-out;
}

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

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--background-panel);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease;
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Info Cards */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.info-card {
    background: var(--background-panel);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
}

.info-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.status-item .label {
    color: var(--text-secondary);
}

.value.online {
    color: var(--success-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.value.online i {
    font-size: 0.6rem;
    animation: flash 2s infinite;
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Endpoints */
.endpoint-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.method {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.method.get {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.method.post {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-color);
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

label i {
    width: 20px;
    margin-right: 0.25rem;
    color: var(--primary-color);
}

input,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

@supports (-webkit-touch-callout: none) {
    /* iOS specific fixes */
    input,
    select {
        font-size: 16px;
        padding: 0.75rem 1rem;
    }
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Responsive - Tablet (768px and below) */
@media (max-width: 768px) {
    .dashboard-container {
        grid-template-areas:
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    /* Fixed top header height */
    .dashboard-header {
        position: sticky;
        top: 0;
        z-index: 90;
        height: 60px;
        padding: 0 1rem;
    }

    /* Mobile Sidebar Drawer */
    .sidebar-drawer {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: var(--background-panel);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        border-right: 1px solid var(--glass-border);
    }

    .sidebar-drawer.mobile-open {
        transform: translateX(0);
    }

    .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.5rem 1rem;
        background: rgba(15, 23, 42, 0.95);
        border-bottom: 1px solid var(--glass-border);
    }

    .drawer-header h2 {
        font-size: 1.1rem;
        margin: 0;
        padding: 0;
        border: none;
    }

    .close-drawer-btn {
        display: flex;
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }

    .dashboard-nav {
        padding: 1rem 0;
        display: flex;
        flex-direction: column;
        background: transparent;
    }

    .nav-item {
        border-radius: 0;
        padding: 1.25rem 1.5rem;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .dashboard-main {
        padding: 1.5rem 1rem;
    }
}

    /* Content sections */
    .content-section h2 {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 1.75rem;
    }

    .stat-info h3 {
        font-size: 1.5rem;
    }

    /* Info Cards */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .info-card {
        padding: 1.5rem;
    }

    .info-card h3 {
        font-size: 1rem;
    }

    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    label {
        font-size: 0.85rem;
    }

    input,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.85rem 1rem;
    }

    /* Buttons */
    .btn {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    .btn i {
        font-size: 0.9rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 1rem;
    }

    /* Endpoint items */
    .endpoint-item {
        flex-wrap: wrap;
        padding: 1rem;
    }

    .method {
        font-size: 0.65rem;
    }

    code {
        font-size: 0.85rem;
        word-break: break-all;
    }

    /* History items */
    .history-item {
        flex-wrap: wrap;
        padding: 1rem;
        font-size: 0.85rem;
    }

    .history-item .type {
        font-size: 0.7rem;
    }

    .history-item .timestamp {
        font-size: 0.75rem;
        width: 100%;
        margin-top: 0.5rem;
    }

    .copy-btn {
        width: 100%;
        margin-top: 1rem;
    }


/* Slide in animation for mobile menu */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Optional: Overlay for mobile menu */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
}

.mobile-menu-overlay.show {
    display: block;
}

@media (max-width: 768px) {
    .mobile-menu-overlay.show {
        display: block;
    }
}

/* Responsive - Mobile (480px and below) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .login-box {
        padding: 2rem 1rem;
        margin: 1rem;
        border-radius: 1rem;
    }

    .login-header i {
        font-size: 2.5rem;
    }

    .login-header h1 {
        font-size: 1.25rem;
    }

    .dashboard-header {
        padding: 0.75rem;
    }

    .header-content {
        flex-direction: row;
        gap: 0.5rem;
    }

    .header-title {
        font-size: 1rem;
        flex: 1;
        margin: 0;
    }

    .header-right {
        gap: 0.5rem;
    }

    .mobile-menu-btn {
        display: flex !important;
        font-size: 1.3rem;
    }

    .dashboard-nav {
        padding: 1rem 0;
    }

    .dashboard-nav .nav-item {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        gap: 1rem;
        margin: 0;
    }

    .dashboard-nav .nav-item i {
        font-size: 1rem;
    }

    .dashboard-main {
        padding: 1rem;
        padding-bottom: 90px;
    }

    h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    h3 {
        font-size: 0.95rem;
    }

    .stats-grid {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .stat-info h3 {
        font-size: 1.25rem;
    }

    .stat-info p {
        font-size: 0.8rem;
    }

    .info-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .status-item {
        padding: 0.75rem 0;
        font-size: 0.85rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    label {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    label i {
        width: 18px;
    }

    input,
    select {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 0.4rem;
    }

    small {
        font-size: 0.75rem;
        margin-top: 0.3rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        border-radius: 0.4rem;
    }

    .btn i {
        font-size: 0.8rem;
    }

    .form-actions {
        gap: 0.75rem;
        padding-top: 1rem;
    }

    .endpoint-item {
        padding: 0.75rem;
        gap: 0.75rem;
        flex-direction: column;
    }

    .method {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    code {
        font-size: 0.8rem;
    }

    .message-box {
        padding: 0.75rem;
        font-size: 0.85rem;
        margin-top: 0.75rem;
    }

    .history-item {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .history-item .type {
        font-size: 0.65rem;
        min-width: 50px;
    }

    .history-item .timestamp {
        font-size: 0.7rem;
        margin-top: 0.4rem;
    }

    .copy-btn {
        padding: 0.65rem 0.8rem;
        font-size: 0.75rem;
        margin-top: 0.75rem;
    }

    .stats-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .stats-actions .btn {
        font-size: 0.8rem;
    }
}

/* Responsive - Extra Small (360px and below) */
@media (max-width: 360px) {
    .login-box {
        padding: 1.5rem 1rem;
    }

    .login-header i {
        font-size: 2rem;
    }

    .login-header h1 {
        font-size: 1.1rem;
    }

    .header-title {
        font-size: 0.9rem;
        flex: 1;
    }

    .header-right {
        gap: 0.4rem;
    }

    .mobile-menu-btn {
        display: flex !important;
        font-size: 1.2rem;
    }

    .dashboard-nav .nav-item {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .dashboard-nav .nav-item i {
        font-size: 0.9rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .stat-info h3 {
        font-size: 1.1rem;
    }

    .stat-info p {
        font-size: 0.75rem;
    }

    .info-card {
        padding: 0.75rem;
    }

    input,
    select {
        padding: 0.7rem;
    }

    .btn {
        padding: 0.7rem 0.8rem;
        font-size: 0.8rem;
    }

    .copy-btn {
        padding: 0.6rem 0.7rem;
        font-size: 0.7rem;
    }
}

/* Utilities */
.message-box {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    display: none;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease-out;
}

.message-box.show {
    display: block;
}

.message-box.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.message-box.error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}

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

.history-item .type {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    width: 60px;
    text-align: center;
}

.history-item .type.rtc {
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent-color);
}

.history-item .type.rtm {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-color);
}

.history-item .type.admin {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.history-item .timestamp {
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}