:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-success: #10b981;
    --accent-success-hover: #059669;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(15, 23, 42, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-family: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 80px; /* Space for fixed status bar */
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #4f46e5;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: #06b6d4;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 30vw;
    height: 30vw;
    background: #ec4899;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* App Container */
.app-container {
    max-width: 95%;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

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

.logo i {
    font-size: 2rem;
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444; /* Default disconnected */
    transition: background-color 0.3s ease;
}

.status-badge.connected .dot {
    background-color: #10b981;
    box-shadow: 0 0 10px #10b981;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(12px);
    animation: fadeInDown 0.6s ease;
}

.welcome-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.welcome-title i {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: wave 2s ease-in-out infinite;
    transform-origin: 70% 70%;
    display: inline-block;
    font-size: 1.25rem;
}

.welcome-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.welcome-subtitle i {
    color: var(--accent-primary);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    10%, 30% {
        transform: rotate(14deg);
    }
    20% {
        transform: rotate(-8deg);
    }
    40% {
        transform: rotate(-4deg);
    }
    50% {
        transform: rotate(10deg);
    }
    60% {
        transform: rotate(0deg);
    }
}

/* Main Content Grid (Legacy - for backwards compatibility) */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Unified Layout with Sidebar */
.unified-main {
    display: flex;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Sidebar Collapse Button */
.sidebar-collapse-btn {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    border-radius: 0 0.5rem 0.5rem 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: none;
    backdrop-filter: blur(12px);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    z-index: 10;
}

.sidebar-collapse-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    width: 28px;
}

/* App Sidebar */
.app-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 1.5rem;
    margin-right: 0.5rem;
}

.app-sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.app-sidebar.collapsed .sidebar-header h3,
.app-sidebar.collapsed .sidebar-nav {
    display: none;
}

.app-sidebar.collapsed .sidebar-header {
    padding: 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-sidebar.collapsed .sidebar-collapse-btn {
    right: -24px;
}

.app-sidebar .sidebar-header {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(12px);
}

.app-sidebar .sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    color: var(--text-primary);
}

.app-sidebar .sidebar-header h3 i {
    color: var(--accent-primary);
}

.app-sidebar .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.app-sidebar .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    backdrop-filter: blur(12px);
}

.app-sidebar .sidebar-nav-item:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateX(4px);
}

.app-sidebar .sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(168, 85, 247, 0.2));
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.app-sidebar .sidebar-nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.app-sidebar .sidebar-nav-link {
    text-decoration: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: auto;
    height: auto;
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: auto;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    backdrop-filter: blur(12px);
}

.sidebar-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
    font-size: 0.95rem;
}

.app-sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* App Content Area */
.app-content {
    flex: 1;
    min-width: 0;
}

.app-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.app-view.active {
    display: block;
}

.view-content-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 1200px) {
    .view-content-grid {
        grid-template-columns: 1fr;
    }
}

/* Collapsible Filters */
#filters-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

#filters-content.collapsed {
    max-height: 0;
    opacity: 0;
}

@media (max-width: 900px) {
    .unified-main {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
    }

    .app-sidebar.collapsed {
        width: 0;
    }

    .app-sidebar .sidebar-nav {
        flex-direction: column;
    }

    .app-sidebar .sidebar-nav-item {
        flex-shrink: 0;
    }

    .sidebar-collapse-btn {
        display: none;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
}

.panel-header {
    margin-bottom: 2rem;
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.panel-header h2 i {
    color: var(--accent-primary);
}

.panel-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

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

.form-group select,
.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.form-group select option {
    background: var(--bg-color);
    color: var(--text-primary);
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.input-wrapper select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.input-wrapper select option {
    background: var(--bg-color);
    color: var(--text-primary);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.toggle-visibility {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.toggle-visibility:hover {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-success);
    color: white;
    width: 100%;
}

.btn-success:hover {
    background: var(--accent-success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Status Monitor */
.status-monitor {
    margin-top: 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.status-monitor-header {
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-display {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    min-height: 200px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.status-indicator i {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.idle i {
    color: var(--text-secondary);
}

.status-indicator.running i {
    color: #fbbf24;
}

.status-indicator.success i {
    color: #10b981;
    animation: none;
}

.status-indicator.error i {
    color: #ef4444;
    animation: none;
}

.status-text {
    color: var(--text-primary);
}

.status-message {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
    max-width: 400px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status Bar at Bottom */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    z-index: 100;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

.status-bar-content {
    max-width: 95%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.status-indicator-circle.idle {
    background-color: var(--text-secondary);
}

.status-indicator-circle.running {
    background-color: #fbbf24;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 10px #fbbf24;
}

.status-indicator-circle.success {
    background-color: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.status-indicator-circle.error {
    background-color: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

.status-bar .status-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    min-width: 100px;
}

.status-bar .status-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
    font-size: 1.1rem;
}

.btn-icon:hover {
    color: var(--accent-primary);
}

.edit-user-btn:hover {
    color: var(--accent-primary);
}

.delete-user-btn:hover {
    color: #c82333 !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease forwards;
    min-width: 200px;
}

.toast.success { border-left: 4px solid var(--accent-success); }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid var(--accent-primary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* User Menu & Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar i {
    font-size: 1.5rem;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-primary);
}

.btn-text {
    background: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    text-decoration: none;
}

.btn-text:hover {
    color: #ef4444;
}

/* Logs Page Styles */
.logs-main {
    max-width: 1400px;
    margin: 0 auto;
}

.logs-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-select {
    padding: 0.5rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.logs-table-container {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.logs-table thead {
    background: rgba(0, 0, 0, 0.4);
    position: sticky;
    top: 0;
}

.logs-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.logs-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logs-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.logs-table .timestamp {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: 'Menlo', monospace;
    white-space: nowrap;
}

.logs-table .user {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.logs-table .message {
    color: var(--text-primary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.type-auth {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge.type-automation {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.badge.type-config {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.badge.status-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.badge.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.badge.status-warning {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.badge.status-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.logs-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.loading, .no-data, .error {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.loading i, .no-data i, .error i {
    margin-right: 0.5rem;
}

.error {
    color: #f87171;
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Admin Dashboard Styles */
.table-container {
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    margin-top: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

.table-container::-webkit-scrollbar {
    height: 12px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 0.75rem 0.75rem;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 6px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table thead {
    background: rgba(0, 0, 0, 0.4);
    position: sticky;
    top: 0;
}

.admin-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.badge-admin {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.badge-user {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.customers-preview {
    color: var(--text-primary);
    font-size: 0.85rem;
}

.no-customers {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
}

.customers-cell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    padding: 0;
    font-family: var(--font-family);
}

.btn-link:hover {
    color: var(--accent-hover);
}

.loading-row {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 0;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.modal-header h3 i {
    color: var(--accent-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-right {
        flex-direction: column;
        align-items: flex-end;
    }

    .user-info {
        display: none;
    }

    .logs-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }

    .logs-table {
        font-size: 0.8rem;
    }

    .logs-table th, .logs-table td {
        padding: 0.5rem;
    }
}

/* SFTP Page Styles */
.sftp-main {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Left Sidebar */
.sftp-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.sidebar-header {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(12px);
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    color: var(--text-primary);
}

.sidebar-header h3 i {
    color: var(--accent-primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    backdrop-filter: blur(12px);
}

.sidebar-nav-item:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateX(4px);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(168, 85, 247, 0.2));
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.sidebar-nav-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sidebar-nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Right Content Area */
.sftp-content {
    flex: 1;
    min-width: 0;
}

.sftp-view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.sftp-view.active {
    display: block;
}

.sftp-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.sftp-status i {
    font-size: 1.25rem;
}

.info-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.75rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-box i {
    color: var(--accent-primary);
    font-size: 1.25rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Responsive Layout */
@media (max-width: 900px) {
    .sftp-main {
        flex-direction: column;
    }

    .sftp-sidebar {
        width: 100%;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar-nav-item {
        flex-shrink: 0;
    }
}

/* Client Matrix Styles */
.stats-grid {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    flex: 0 0 auto;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-primary);
}

.stat-icon {
    width: 24px;
    height: 24px;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 0.75rem;
    color: white;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.stat-label {
    font-size: 0.625rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1;
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-subvalue {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
    line-height: 1;
    margin-top: 0.15rem;
}

/* Filters Row */
.filters-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group .input-wrapper {
    width: 100%;
}

.filter-group .input-wrapper input,
.filter-group .input-wrapper select {
    width: 100%;
}

/* Projects Table */
.projects-table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.projects-table thead {
    background: rgba(0, 0, 0, 0.4);
    position: sticky;
    top: 0;
}

.projects-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.projects-table th:hover {
    color: var(--text-primary);
}

.projects-table th[data-sort] {
    position: relative;
}

.projects-table th i {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.6;
}

.projects-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.projects-table tbody tr {
    transition: background 0.2s ease;
}

.projects-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.project-name {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.budget-cell {
    text-align: right;
    font-family: 'Menlo', monospace;
    font-weight: 500;
    color: var(--text-primary);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.status-full {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.status-support {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-badge.status-hold {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-badge.status-default {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Platform Badges */
.platform-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.platform-badge.platform-OPAL {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.platform-badge.platform-DIAMOND {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(147, 51, 234, 0.2));
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.platform-badge.platform-EMERALD {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.platform-badge.platform-AMMOLITE {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.4);
}

/* Budget Progress Bar */
.budget-progress {
    position: relative;
    width: 100%;
    height: 32px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.budget-progress-bar {
    height: 100%;
    transition: width 0.3s ease;
    position: relative;
}

.budget-progress-bar.success {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.4), rgba(16, 185, 129, 0.6));
}

.budget-progress-bar.warning {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.4), rgba(251, 191, 36, 0.6));
}

.budget-progress-bar.danger {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.4), rgba(239, 68, 68, 0.6));
}

.budget-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Empty and Loading States */
.empty-row,
.error-row,
.loading-row {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.empty-row i,
.error-row i,
.loading-row i {
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

.error-row {
    color: #f87171;
}

.loading-row i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Client Matrix */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-table {
        font-size: 0.85rem;
    }

    .projects-table th,
    .projects-table td {
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filters-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        min-width: 100%;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .projects-table {
        min-width: 1200px;
    }
}
