/* ============================================
   pibiCo Brand Guidelines — CSS
   "Industrial Precision meets Digital Clarity"
   Version 1.0 — February 2026
   ============================================ */

/* --- Custom Properties --- */
:root {
    /* Typography */
    --font-brand: 'Raleway', 'Montserrat', 'Arial', sans-serif;
    --font-heading: 'Montserrat', 'Arial', 'Helvetica Neue', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code',
                 'SF Mono', 'Consolas', monospace;

    /* Primary Colors */
    --primary-color: #4682b4;
    --secondary-color: #6a9bc3;
    --accent-color: #2c5171;

    /* Text */
    --text-color: #333;
    --text-light: #666;

    /* Background */
    --bg-gradient: linear-gradient(135deg, #2c5171 0%, #4682b4 50%, #6a9bc3 100%);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);

    /* Radius */
    --radius: 12px;
    --radius-sm: 8px;
}

/* --- Base Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-color);
    background: var(--bg-gradient);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6,
.app-header-title {
    font-family: var(--font-heading);
    color: var(--text-color);
    line-height: 1.1;
}

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
h4 { font-size: 0.875rem; font-weight: 500; }

code, pre, .mono {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.brand-text, .tagline, .lema {
    font-family: var(--font-brand);
}

p, li, td, th, label, span {
    line-height: 1.2;
}

small, .text-caption {
    font-size: 0.75rem;
}

.text-muted {
    color: var(--text-light);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
}

/* --- App Layout --- */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Navbar (App Header) --- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    line-height: 1;
}

.app-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--accent-color);
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header-actions .nav-link {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-color);
    padding: 3px 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.app-header-actions .nav-link:hover {
    background: rgba(70, 130, 180, 0.1);
    color: var(--primary-color);
}

/* --- Main Content --- */
.app-main {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Footer --- */
.app-footer {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1;
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.footer-sep {
    color: #ccc;
}

/* --- Cards (Glassmorphism) --- */
.pibico-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    line-height: 1.2;
}

.pibico-card > * {
    line-height: 1.1;
}

/* --- Slide Panel --- */
.pibico-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pibico-panel-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.pibico-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 45%;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.pibico-panel.active {
    transform: translateX(0);
}

.pibico-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--accent-color);
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    position: sticky;
    top: 0;
    z-index: 1;
    line-height: 1.1;
}

.pibico-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.pibico-panel-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.pibico-panel-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

/* --- Buttons --- */
.pibico-btn {
    padding: 3px 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.pibico-btn-primary:hover:not(:disabled) {
    background: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(70, 130, 180, 0.3);
}

.pibico-btn-icon {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
}

.pibico-btn-icon:hover:not(:disabled) {
    background: rgba(70, 130, 180, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.pibico-btn-outline {
    background: transparent;
    color: var(--primary-color);
    box-shadow: inset 0 0 0 1.5px var(--primary-color);
}

.pibico-btn-outline:hover:not(:disabled) {
    background: rgba(70, 130, 180, 0.1);
}

.pibico-btn-ghost {
    background: transparent;
    color: var(--text-light);
}

.pibico-btn-ghost:hover:not(:disabled) {
    background: rgba(70, 130, 180, 0.1);
    color: var(--text-color);
}

.pibico-btn-danger {
    background: #ef4444;
    color: white;
}

.pibico-btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
}

.pibico-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Form Inputs --- */
.pibico-input,
.pibico-select,
.pibico-textarea {
    width: 100%;
    padding: 3px 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.2;
    background: white;
    color: var(--text-color);
    transition: all 0.2s;
}

.pibico-input:focus,
.pibico-select:focus,
.pibico-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(70, 130, 180, 0.1);
}

.pibico-input:disabled,
.pibico-select:disabled,
.pibico-textarea:disabled {
    background: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}

.pibico-label {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--text-light);
    margin-bottom: 2px;
    display: block;
}

/* --- Tables --- */
.pibico-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.2;
}

.pibico-table th {
    background: var(--accent-color);
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 6px 12px;
    text-align: left;
}

.pibico-table th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.pibico-table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.pibico-table td {
    padding: 4px 12px;
    border-bottom: 1px solid var(--glass-border);
}

.pibico-table tr:last-child td {
    border-bottom: none;
}

.pibico-table tr:hover td {
    background: rgba(70, 130, 180, 0.1);
}

/* --- Badges & Tags --- */
.pibico-badge {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    line-height: 1.2;
}

.pibico-badge-blue {
    background: rgba(70, 130, 180, 0.15);
    color: var(--accent-color);
}

.pibico-badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.pibico-badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #d97706;
}

.pibico-badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.pibico-badge-grey {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-light);
}

/* --- Status Indicators --- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-connected    { background: #10b981; }
.status-connecting   { background: #fbbf24; animation: pulse 1.5s ease-in-out infinite; }
.status-disconnected { background: #ef4444; }
.status-inactive     { background: #94a3b8; }

/* --- Animations --- */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(1.2); }
}

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

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

/* --- Utility Classes --- */
.pibico-flex { display: flex; }
.pibico-flex-col { flex-direction: column; }
.pibico-items-center { align-items: center; }
.pibico-justify-between { justify-content: space-between; }
.pibico-gap-sm { gap: 0.375rem; }
.pibico-gap-md { gap: 0.75rem; }
.pibico-gap-lg { gap: 1.25rem; }
.pibico-grid { display: grid; }
.pibico-grid-2 { grid-template-columns: repeat(2, 1fr); }
.pibico-grid-3 { grid-template-columns: repeat(3, 1fr); }

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(70, 130, 180, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(70, 130, 180, 0.5);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .pibico-panel {
        width: 85%;
    }

    .app-header {
        padding: 0 1rem;
    }

    .app-footer {
        font-size: 0.7rem;
        padding: 0 1rem;
    }

    .pibico-grid-2,
    .pibico-grid-3 {
        grid-template-columns: 1fr;
    }

    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.1rem; }
}
