// EQTL Dev Factory Console - Global Styles
// Firebase-console-like IDP with sidebar layout

@import "variables/colors.less";
@import "variables/typography.less";
@import "variables/spacing.less";

// Base Styles
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: @font-family-base;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;     // never scroll horizontally; sidebar is fixed/off-canvas
}

// Vue cloak
[v-cloak] {
    display: none !important;
}

// Custom scrollbar
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: @color-slate-100;
}

::-webkit-scrollbar-thumb {
    background: @color-slate-300;
    border-radius: 4px;

    &:hover {
        background: @color-slate-400;
    }
}

// Selection
::selection {
    background: fade(@color-primary, 20%);
    color: @color-primary-dark;
}

// Focus styles
:focus-visible {
    outline: 2px solid @color-primary;
    outline-offset: 2px;
}

// Links
a {
    text-decoration: none;
    transition: color 0.2s ease;
}

// Buttons
button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

// Form elements
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

// Console sidebar layout
.console-layout {
    display: flex;
    min-height: 100vh;
}

.console-sidebar {
    width: 260px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.3s ease;
}

.console-main {
    margin-left: 260px;
    flex: 1;
    min-width: 0;          // allow flex child to shrink below content size
    max-width: calc(100vw - 260px);
    min-height: 100vh;
}

// Admin table styles
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;

    th {
        font-weight: @font-weight-semibold;
        font-size: @font-size-xs;
        text-transform: uppercase;
        letter-spacing: @letter-spacing-wider;
        color: @color-slate-500;
        padding: @spacing-sm @spacing-md;
        text-align: left;
        border-bottom: 2px solid @color-slate-200;
    }

    td {
        padding: @spacing-sm @spacing-md;
        border-bottom: 1px solid @color-slate-100;
        font-size: @font-size-sm;
        color: @color-slate-700;
    }

    tbody tr {
        transition: background-color 0.15s ease;

        &:hover {
            background-color: @color-slate-50;
        }
    }
}

// Status badges - Firebase-console-like provisioning lifecycle
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px @spacing-xs;
    border-radius: @radius-full;
    font-size: @font-size-xs;
    font-weight: @font-weight-medium;
    white-space: nowrap;

    &::before {
        content: '';
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

    &.active {
        background: @color-success-light;
        color: darken(@color-success, 18%);
    }

    &.provisioning,
    &.pending {
        background: @color-warning-light;
        color: darken(@color-warning, 18%);

        &::before {
            animation: pulse 1.2s ease-in-out infinite;
        }
    }

    &.failed {
        background: @color-error-light;
        color: darken(@color-error, 12%);
    }

    &.deleting {
        background: @color-slate-100;
        color: @color-slate-500;
    }

    // Resource handed off to the IaC pipeline; nothing exists in AWS yet.
    &.delegated {
        background: #e0f2fe; // sky-100
        color: #0369a1;      // sky-700
    }
}

// Admin stat cards
.admin-stat-card {
    background: white;
    border-radius: @radius-xl;
    padding: @spacing-lg;
    border: 1px solid @color-slate-200;
    transition: all 0.3s ease;

    &:hover {
        box-shadow: @shadow-md;
        border-color: fade(@color-primary, 30%);
    }
}

// Firebase-like project card
.project-card {
    background: white;
    border-radius: @radius-2xl;
    border: 1px solid @color-slate-200;
    transition: all 0.2s ease;
    cursor: pointer;

    &:hover {
        box-shadow: @shadow-lg;
        border-color: fade(@color-primary, 40%);
        transform: translateY(-2px);
    }
}

// Form styles
.form-group {
    margin-bottom: @spacing-lg;

    label {
        display: block;
        font-weight: @font-weight-medium;
        font-size: @font-size-sm;
        color: @color-slate-700;
        margin-bottom: @spacing-1;
    }

    input, textarea, select {
        width: 100%;
        padding: @spacing-xs @spacing-sm;
        border: 1px solid @color-slate-300;
        border-radius: @radius-lg;
        font-size: @font-size-sm;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;

        &:focus {
            border-color: @color-primary;
            box-shadow: 0 0 0 3px fade(@color-primary, 15%);
            outline: none;
        }
    }

    textarea {
        resize: vertical;
        min-height: 100px;
    }
}

// Animations
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

// Responsive: collapse sidebar on small screens
@media (max-width: 768px) {
    .console-sidebar {
        transform: translateX(-100%);

        &.open {
            transform: translateX(0);
        }
    }

    .console-main {
        margin-left: 0;
        max-width: 100vw;
    }
}
