@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

@layer base {
  :root {
    /* Cores de Fundo e Texto */
    --background: oklch(1 0 0);
    --foreground: oklch(.145 0 0);
    
    /* Cores de Cards e Popovers */
    --card: oklch(1 0 0);
    --card-foreground: oklch(.145 0 0);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(.145 0 0);
    
    /* Cores Primárias e Secundárias */
    --primary: oklch(67.35% .153 159.64);
    --primary-foreground: oklch(.985 0 0);
    --secondary: oklch(.97 0 0);
    --secondary-foreground: oklch(.205 0 0);
    
    /* Cores de Mutagem e Acabamento */
    --muted: oklch(.97 0 0);
    --muted-foreground: oklch(.556 0 0);
    --accent: oklch(.97 0 0);
    --accent-foreground: oklch(.205 0 0);
    
    /* Alertas e Destrutivos */
    --destructive: oklch(.577 .245 27.325);
    --destructive-foreground: oklch(.577 .245 27.325);
    
    /* Bordas e Inputs */
    --border: oklch(.922 0 0);
    --input: oklch(.922 0 0);
    --ring: oklch(.708 0 0);
    
    /* Raio das bordas padrão */
    --radius: .625rem;

    /* Sidebar (Menu Lateral) */
    --sidebar: oklch(.985 0 0);
    --sidebar-foreground: oklch(.145 0 0);
    --sidebar-primary: oklch(.205 0 0);
    --sidebar-primary-foreground: oklch(.985 0 0);
    --sidebar-accent: oklch(.97 0 0);
    --sidebar-accent-foreground: oklch(.205 0 0);
    --sidebar-border: oklch(.922 0 0);
    --sidebar-ring: oklch(.708 0 0);
  }

  /* Modo Escuro (Dark Mode) - Será o padrão */
  .dark, body {
    --background: oklch(.145 0 0);
    --foreground: oklch(.985 0 0);
    --card: oklch(0.2 0 0); /* Slightly lighter than background for cards */
    --card-foreground: oklch(.985 0 0);
    --popover: oklch(.145 0 0);
    --popover-foreground: oklch(.985 0 0);
    --primary: oklch(88.18% .202 159.34); /* Bright Green */
    --primary-foreground: oklch(.205 0 0); /* Dark text on primary */
    --secondary: oklch(.269 0 0);
    --secondary-foreground: oklch(.985 0 0);
    --muted: oklch(.269 0 0);
    --muted-foreground: oklch(.708 0 0);
    --accent: oklch(.269 0 0);
    --accent-foreground: oklch(.985 0 0);
    --destructive: oklch(.396 .141 25.723);
    --destructive-foreground: oklch(.637 .237 25.331);
    --border: oklch(.269 0 0);
    --input: oklch(.269 0 0);
    --ring: oklch(.439 0 0);
    --sidebar: oklch(.16 0 0); /* Sidebar slightly different from background */
    --sidebar-foreground: oklch(.985 0 0);
    --sidebar-primary: oklch(88.18% .202 159.34);
    --sidebar-primary-foreground: oklch(.985 0 0);
    --sidebar-accent: oklch(.269 0 0);
    --sidebar-accent-foreground: oklch(.985 0 0);
    --sidebar-border: oklch(.269 0 0);
    --sidebar-ring: oklch(.439 0 0);
  }
}

@layer base {
  * {
    border-color: var(--border);
    outline-color: var(--ring);
    box-sizing: border-box;
  }

  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
  }

  body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  }

  /* Customização de Scrollbar */
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  ::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
  }
  
  ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    background-clip: content-box;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: background-color 0.2s;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.25);
  }

  * {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  }
}

/* Layout Components */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 40;
}

.sidebar-header {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    padding: 1rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-foreground);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background-color: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
}

.sidebar-link.active {
    border-color: var(--primary);
    color: var(--primary);
    background-color: transparent; /* match the screenshot */
}

.sidebar-footer {
    padding: 1.5rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Main Area */
.main-area {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    gap: 1.5rem;
    background-color: var(--background);
}

.topbar-link {
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.topbar-link:hover {
    color: var(--foreground);
}

/* Page Content */
.page-content {
    padding: 2rem;
    flex: 1;
}

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

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Auth / Install Center */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--background);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

/* Cards */
.card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    color: var(--card-foreground);
}

.glass { /* Backwards compatibility */
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-title {
    font-weight: 600;
    font-size: 1.125rem;
}

/* Grid for Instances */
.instances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.instance-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.instance-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.instance-row {
    display: flex;
    justify-content: space-between;
}

.instance-label {
    color: var(--muted-foreground);
}

.instance-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

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

.form-label, label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--foreground);
    font-weight: 500;
}

.form-control, input, select, textarea {
    width: 100%;
    padding: 0.6rem 1rem;
    background-color: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.search-bar {
    background-color: var(--input);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    padding-left: 2.5rem;
    border-radius: var(--radius);
    color: var(--foreground);
    width: 300px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

.btn:hover {
    opacity: 0.9;
}

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

.btn-icon {
    padding: 0.5rem;
    background-color: var(--secondary);
    color: var(--foreground);
    border: 1px solid var(--border);
}

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

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

.btn-danger:hover {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

/* Badges / Status */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
}

.text-success { color: oklch(0.65 0.15 150); } /* Green text */
.text-danger { color: var(--destructive); }
.text-warning { color: oklch(0.7 0.15 60); }

/* Utilities */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.w-full { width: 100%; }

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

.stat-title {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--foreground);
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted-foreground);
    font-weight: 500;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

@media (max-width: 768px) {
    .layout-wrapper { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
    .main-area { margin-left: 0; }
    .instances-grid { grid-template-columns: 1fr; }
}
