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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #0a0b24;
    color: white;
    height: 100vh;
    overflow: hidden;
}

.container {
    background: radial-gradient(50% 50% at center bottom, rgba(0, 100, 255, 0.5) 0%, rgba(0, 100, 255, 0.00) 100%);
    min-height: 100vh;
    height: 100vh;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 2rem;
    transition: all 0.3s ease;
}

header.header-compact {
    margin-bottom: 2rem;
    padding-top: 1.5rem;
}


.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.header-title {
    flex: 1;
    text-align: center;
}

.logo-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
}

.quix-logo {
    height: 3rem;
    width: auto;  /* Base size for multiple cards */
    max-width: 100%;
    filter: brightness(0) invert(1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.quix-logo:hover {
    transform: scale(1.05);
}

/* When many platforms, adjust header layout */
.container.has-many-platforms .header-title {
    text-align: left;
    flex: 1;
}

.container.has-many-platforms .logo-section {
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.container.has-many-platforms .quix-logo {
    width: auto;
}

.header-search {
    flex: 0 1 300px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    transition: font-size 0.3s ease;
    margin: 0;
}

.header-compact .subtitle {
    font-size: 0.875rem;
}

/* Search Styles */
.search-wrapper {
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.search-wrapper.compact {
}

.search-wrapper:focus-within {
    border-color: #3d89ff;
    box-shadow: 0 0 8px rgba(61, 137, 255, 0.4);
    background: rgba(255, 255, 255, 0);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.search-wrapper.compact .search-icon {
    left: 1rem;
}

.search-input {
    width: 100%;
    padding: 1rem 3.5rem;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.search-wrapper.compact .search-input {
    padding: 0.75rem 2.75rem;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Environments Container */
.environments-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 2rem;
}

/* For many platforms, align to top to allow scrolling */
.container.has-many-platforms .environments-container {
    align-items: flex-start;
    padding-top: 2rem;
}

/* 1-2 platforms view - adjust vertical positioning (not during search) */
.container:not(.has-many-platforms) .environments-container:has(.environments-grid[data-platform-count="1"]),
.container:not(.has-many-platforms) .environments-container:has(.environments-grid[data-platform-count="2"]) {
    margin-top: -2rem;
}

.environments-grid {
    display: grid;
    gap: 1.5rem;
    width: 100%;
    transition: all 0.3s ease;
}

/* Adaptive Grid Layouts based on platform count */

/* 1 Platform - Hero Layout */
.environments-grid[data-platform-count="1"] {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin: 0 auto;
}

/* 1-2 Platforms - Large card styling (not during search) */
.container:not(.has-many-platforms) .environments-grid[data-platform-count="1"] .env-card,
.container:not(.has-many-platforms) .environments-grid[data-platform-count="2"] .env-card {
    min-height: 240px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 100, 255, 0.15);
}

.container:not(.has-many-platforms) .environments-grid[data-platform-count="1"] .env-card:hover,
.container:not(.has-many-platforms) .environments-grid[data-platform-count="2"] .env-card:hover {
    transform: scale(1.05) translateY(-2px);
}

.container:not(.has-many-platforms) .environments-grid[data-platform-count="1"] .env-name,
.container:not(.has-many-platforms) .environments-grid[data-platform-count="2"] .env-name {
    font-size: 1.5rem;
}

.container:not(.has-many-platforms) .environments-grid[data-platform-count="1"] .env-url,
.container:not(.has-many-platforms) .environments-grid[data-platform-count="2"] .env-url {
    font-size: 0.875rem;
}

.container:not(.has-many-platforms) .environments-grid[data-platform-count="1"] .btn-primary,
.container:not(.has-many-platforms) .environments-grid[data-platform-count="2"] .btn-primary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.container:not(.has-many-platforms) .environments-grid[data-platform-count="1"] .last-visited,
.container:not(.has-many-platforms) .environments-grid[data-platform-count="2"] .last-visited {
    font-size: 0.75rem;
}

/* 2 Platforms - Two Column with large cards */
.environments-grid[data-platform-count="2"] {
    grid-template-columns: repeat(2, 1fr);
    max-width: 900px;
    margin: 0 auto;
    gap: 2.5rem;  /* Larger gap for 2-card layout */
}

/* 3-4 Platforms - Standard Grid */
.environments-grid[data-platform-count="3"],
.environments-grid[data-platform-count="4"] {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    max-width: 900px;
}

/* 5+ Platforms - Dense Grid */
.environments-grid[data-platform-count="5"] {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    max-width: 1200px;
}

/* When search is visible, adjust header */
.container.has-many-platforms header {
    text-align: left;
    padding-top: 1rem;
    margin-bottom: 2rem;
}

.container.has-many-platforms .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Environment Card Styles */
.env-card {
    background: rgba(10, 11, 36, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.env-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 48px rgba(61, 137, 255, 0.24);
    border-color: #3d89ff;
    background: rgba(255, 255, 255, 0.04);
}


/* Pinned card */
.env-card.pinned {
    border-color: rgba(61, 137, 255, 0.5);
    box-shadow: 0 0 24px rgba(61, 137, 255, 0.16);
}

.env-card.pinned:hover {
    box-shadow: 0 0 48px rgba(61, 137, 255, 0.24);
    border-color: #3d89ff;
}

.pin-indicator {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    color: #ffb400;
    display: none;
}

.env-card.pinned .pin-indicator {
    display: block;
}

.env-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.env-card-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.env-card:hover .env-card-actions {
    opacity: 1;
}

.env-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0;
    word-break: break-word;
}


.env-url {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin: 0 0 1.5rem 0;
    word-break: break-all;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.env-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-primary {
    padding: 0.75rem 1.25rem;
    border-radius: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #3d89ff;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #0064ff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.25rem;
    border-radius: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-icon {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

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

.btn-icon.pin:hover {
    color: #ffb400;
}

.btn-icon.edit:hover {
    color: #66a2ff;
}

.btn-icon.remove:hover {
    color: #ff6b6b;
}

.btn-icon svg {
    width: 1rem;
    height: 1rem;
}

.last-visited {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1rem;
}

/* Add Platform Card - Lighter visual weight */
.add-card {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 0.5rem;
    padding: 1.5rem;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-card:hover {
    border-color: rgba(61, 137, 255, 1);
    background: rgba(61, 137, 255, 0.04);
    transform: translateY(-2px);
}

.add-card svg {
    color: #3d89ff;
    margin-bottom: 1rem;
}

.add-card:hover svg {
    color: #ffffff;
}

.add-card p {
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    margin: 0;
}

.add-card:hover p {
    color: rgba(255, 255, 255, 1);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d89ff 0%, #0064ff 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 100, 255, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 100, 255, 0.4);
}

.fab:active {
    transform: scale(0.95);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 11, 22, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: rgb(10 11 22 / 70%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: rgba(255, 255, 255, 1);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.25rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3d89ff;
    background: rgba(255, 255, 255, 0);
}

/* Custom validation styling */
.form-group input:invalid {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-group input:invalid:focus {
    border-color: #3d89ff;
    box-shadow: 0 0 0 3px rgba(61, 137, 255, 0.24);
}

.form-group.error input {
    border-color: #ff3d3d;
    background: rgba(255, 61, 61, 0.08);
}

.form-group.error input:focus {
    border-color: #ff3d3d;
    box-shadow: 0 0 0 4px rgba(255, 61, 61, 0.24);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
}

.form-error {
    display: none;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #ff6b6b;
    animation: slideDown 0.2s ease;
}

.form-group.error .form-error {
    display: block;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive Design */
@media (max-width: 1400px) {
    .environments-grid[data-platform-count="5"] {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 1200px) {
    .environments-grid[data-platform-count="4"] {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .environments-grid[data-platform-count="5"] {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 900px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-title {
        text-align: center !important;
    }

    .header-search {
        width: 100%;
        max-width: 400px;
    }

    .environments-grid[data-platform-count="3"],
    .environments-grid[data-platform-count="4"],
    .environments-grid[data-platform-count="5"] {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .header-compact h1 {
        font-size: 1.75rem;
    }

    .environments-grid[data-platform-count="2"] {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .environments-grid[data-platform-count="3"],
    .environments-grid[data-platform-count="4"],
    .environments-grid[data-platform-count="5"] {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    header {
        padding-top: 1rem;
        margin-bottom: 2rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .environments-grid {
        gap: 1rem;
    }

    .env-card {
        padding: 1.25rem;
    }
}