/* --- Base & Typography --- */
:root {
    --bg-color: #0d1117;
    --primary-color: #c9d1d9;
    --secondary-color: #8b949e;
    --border-color: #30363d;
    --card-bg: #161b22;
    --accent-color: #ff4d4d;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-family: var(--font-family);
    margin: 0;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: 600;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Layout --- */
.container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
}

main {
    padding: 2rem 0;
}

/* --- Navigation --- */
nav {
    background-color: var(--card-bg);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 1.5rem;
    font-weight: bold;
}
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
nav ul li a {
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}
nav ul li a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--accent-color);
    transition: all 0.2s ease-in-out;
}
.btn:hover {
    background-color: #e60000;
    border-color: #e60000;
    text-decoration: none;
}

/* --- Cards --- */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h2, .card-header h3 {
    margin: 0;
}

/* --- Forms --- */
form label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary-color);
}
form input, form textarea {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    color: var(--primary-color);
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
form input:focus, form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.3);
}
form button {
    align-self: flex-start;
}

/* --- Toggle Switch --- */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input { display: none; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #30363d;
  transition: .4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 4px; bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(26px); }

/* --- List Items (Licenses, Users, etc.) --- */
.app-list { list-style: none; padding: 0; margin: 0; }
.app-list-item {
    background-color: transparent;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}
details.app-list-item[open] {
    background-color: #0d1117;
}
summary {
    list-style: none;
    cursor: pointer;
}
summary::-webkit-details-marker { display: none; }

/* --- Main Dashboard Layout (Flexbox) --- */
.dashboard-layout {
    display: flex;
    gap: 2rem;
}
.dashboard-layout .sidebar {
    width: 350px;
    flex-shrink: 0;
    border-right: none; /* No border for main dashboard sidebar */
    padding-right: 0;
}

/* --- Application Detail Layout (Grid) --- */
.app-detail-layout {
    display: grid;
    grid-template-columns: 280px 1fr; /* Fixed sidebar, flexible content */
    gap: 2rem;
}
.app-detail-layout .sidebar {
    border-right: 1px solid var(--border-color);
    padding-right: 2rem;
}

.content-area { flex-grow: 1; }

.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-menu li a {
    display: block;
    padding: 10px 15px;
    border-radius: 6px;
    color: var(--primary-color);
    font-weight: 500;
    transition: background-color 0.2s;
}
.sidebar-menu a:hover { background-color: #30363d; text-decoration: none; }
.sidebar-menu a.active { background-color: var(--accent-color); color: #fff; }

/* --- Modal --- */
.modal-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(13, 17, 23, 0.8);
    display: none; justify-content: center; align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}
.modal {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.modal h3 { color: var(--accent-color); }
.modal-actions { display: flex; justify-content: center; gap: 1rem; }

/* --- License Management Form --- */
.license-manage-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.license-manage-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #ccc;
}

.license-manage-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 80px;
}

.license-manage-form .form-group {
    margin-bottom: 1rem;
}

.license-manage-form .actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap; /* Allow buttons to wrap on small screens */
}

/* --- License Row Grid --- */
.license-row {
    display: grid;
    grid-template-columns: 40px 2fr 1fr 1fr 1fr; /* Checkbox, Key, Level, Expires, Status */
    align-items: center;
    width: 100%;
    gap: 15px;
    cursor: pointer;
}

.license-row code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    color: #fff;
}

/* --- Pricing Section --- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.pricing-card {
    background-color: #242424;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.pricing-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.pricing-card h3 {
    font-size: 1.5rem;
    color: #ff4d4d;
    margin-bottom: 1rem;
}

.pricing-card .price {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 1.5rem;
}

.pricing-card .price span {
    font-size: 1rem;
    font-weight: normal;
    color: #ccc;
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.pricing-card ul li {
    margin-bottom: 1rem;
    color: #ccc;
}

.pricing-card.featured {
    border-color: #ff4d4d;
    transform: scale(1.05);
}
