/* pibiCo Gateway — App-Specific Styles */

/* Override pibico.css body background */
body {
    background: linear-gradient(135deg, #2c5171 0%, #4682b4 50%, #6a9bc3 100%) !important;
    min-height: 100vh;
    margin: 0;
}

/* ===== 3D Canvas ===== */
#scene3d {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ===== Landing Overlay ===== */
.landing-overlay {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 24px;
    gap: 12px;
    pointer-events: none;
}

.landing-overlay > * {
    pointer-events: auto;
}

.landing-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1100px;
    padding: 20px 0;
}

.landing-heading {
    font-family: 'Figtree', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    margin: 0 0 8px 0;
}

.landing-subtitle {
    font-family: 'Raleway', sans-serif;
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
    margin: 0 0 40px 0;
}

/* ===== Service Cards Grid ===== */
.service-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
}

.service-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.service-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.service-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e3edf5, #d4e3f0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #4682b4;
}

.service-card-body {
    flex: 1;
    min-width: 0;
}

.service-card-body h3 {
    font-family: 'Figtree', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #2c5171;
    margin: 0 0 2px 0;
}

.service-card-body p {
    font-family: 'Raleway', sans-serif;
    font-size: 0.8rem;
    color: #777;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Health Dot ===== */
.health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
    position: absolute;
    top: 12px;
    right: 12px;
}

.health-dot-up {
    background: #4CAF50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
    animation: pulse-green 2s ease-in-out infinite;
}

.health-dot-down {
    background: #999;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 4px rgba(76, 175, 80, 0.4); }
    50% { box-shadow: 0 0 10px rgba(76, 175, 80, 0.8); }
}

/* ===== Navbar ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    min-height: 56px;
    width: 100%;
    max-width: 1100px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    width: 32px;
    height: 32px;
}

.navbar-title {
    font-family: 'Figtree', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2c5171, #4682b4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-nav {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    color: #4682b4;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: rgba(70, 130, 180, 0.1);
}

.user-badge {
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    background: #e3edf5;
    color: #2c5171;
    padding: 4px 12px;
    border-radius: 20px;
}

/* ===== Login Panel Content ===== */
.login-panel-content {
    text-align: center;
    padding: 20px 0;
}

.login-panel-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    font-family: 'Raleway', sans-serif;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Raleway', sans-serif;
    background: #f8f9fa;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #4682b4;
    background: #fff;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-error {
    color: #B33A2B;
    font-size: 0.85rem;
    margin-bottom: 12px;
    min-height: 20px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #4682b4, #2c5171);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(70, 130, 180, 0.4);
}

.btn-danger {
    background: #B33A2B;
    color: #fff;
}

.btn-secondary {
    background: #e8e8ea;
    color: #333;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-icon {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ===== Dashboard Layout ===== */
.dashboard-page {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 24px;
    gap: 12px;
    overflow: hidden;
}

/* ===== Main Content ===== */
.app-main {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    max-width: 1100px;
    padding: 0;
}

/* ===== Status Bar ===== */
.status-bar {
    min-height: 0;
    margin-bottom: 8px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.status-bar.success {
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
    padding: 10px 16px;
    border-radius: 10px;
}

.status-bar.error {
    background: rgba(179, 58, 43, 0.15);
    color: #B33A2B;
    padding: 10px 16px;
    border-radius: 10px;
}

/* ===== Action Bar ===== */
.action-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-group {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.search-group input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: 'Raleway', sans-serif;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    outline: none;
}

.search-group input:focus {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.95);
}

.search-group select {
    padding: 10px 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: 'Raleway', sans-serif;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    outline: none;
    cursor: pointer;
}

/* ===== Links Table ===== */
.links-table {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-loading {
    padding: 40px;
    text-align: center;
    color: #999;
    font-family: 'Raleway', sans-serif;
}

.table-empty {
    padding: 60px 40px;
    text-align: center;
    color: #999;
}

.table-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.link-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.link-row:last-child {
    border-bottom: none;
}

.link-row:hover {
    background: #f8f9fa;
}

.link-type-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: #e3edf5;
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-title {
    font-family: 'Figtree', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-target {
    font-size: 0.8rem;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-code {
    background: #e3edf5;
    color: #2c5171;
    padding: 4px 12px;
    border-radius: 20px;
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.link-code:hover {
    background: #c9dbe9;
}

.link-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    color: #999;
    font-size: 0.8rem;
}

.link-clicks {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.link-date {
    white-space: nowrap;
    min-width: 60px;
}

.link-owner {
    font-size: 0.75rem;
    color: #4682b4;
    font-weight: 600;
    white-space: nowrap;
}

.link-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.link-actions .btn-icon {
    color: #999;
}

.link-actions .btn-icon:hover {
    color: #333;
}

.link-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.link-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.link-badge-pw {
    background: #fff3cd;
    color: #856404;
}

.link-badge-exp {
    background: #f8d7da;
    color: #721c24;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
}

.pagination button {
    background: rgba(255, 255, 255, 0.85);
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.pagination button:hover {
    background: rgba(255, 255, 255, 1);
}

.pagination button.active {
    background: linear-gradient(135deg, #4682b4, #2c5171);
    color: #fff;
}

/* ===== Footer ===== */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
    height: 40px;
    min-height: 40px;
    width: 100%;
    max-width: 1100px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    font-family: 'Raleway', sans-serif;
    font-size: 0.8rem;
    color: #666;
    flex-shrink: 0;
}

.app-footer a {
    color: #4682b4;
    text-decoration: none;
}

.footer-separator {
    color: #ccc;
}

/* ===== Slide Panel ===== */
.panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.panel-overlay.open {
    display: block;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: -50%;
    width: 45%;
    min-width: 380px;
    max-width: 600px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.slide-panel.open {
    right: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
}

.panel-header h2 {
    font-family: 'Figtree', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c5171;
}

.panel-header .btn-icon {
    font-size: 1.5rem;
    color: #999;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

/* Compact form spacing inside panels */
.panel-body .form-group {
    margin-bottom: 8px;
}

.panel-body .form-group label {
    margin-bottom: 3px;
    font-size: 0.8rem;
}

.panel-body .form-group input,
.panel-body .form-group select,
.panel-body .form-group textarea {
    padding: 7px 12px;
    font-size: 0.9rem;
}

.panel-body .form-group textarea {
    min-height: 52px;
}

.panel-body .form-row {
    gap: 8px;
}

.panel-body .form-error {
    margin-bottom: 6px;
    min-height: 0;
}

.panel-body hr {
    margin: 12px 0 !important;
}

/* ===== Type Selector (in panel) ===== */
.type-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.type-tab {
    padding: 5px 12px;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    background: #f8f9fa;
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #555;
}

.type-tab:hover {
    border-color: #4682b4;
    color: #4682b4;
}

.type-tab.active {
    background: linear-gradient(135deg, #4682b4, #2c5171);
    color: #fff;
    border-color: transparent;
}

/* ===== Type Form Sections ===== */
.type-form {
    display: none;
}

.type-form.active {
    display: block;
}

/* ===== Short URL Display ===== */
.short-url-display {
    background: #f0f7fc;
    border: 1.5px solid #c9dbe9;
    border-radius: 10px;
    padding: 14px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.short-url-display input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: monospace;
    font-size: 0.9rem;
    color: #2c5171;
    outline: none;
}

.short-url-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

/* ===== Settings Panel ===== */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    font-family: 'Figtree', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #2c5171;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e3edf5;
}

.user-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    background: #f8f9fa;
}

.user-list-item .user-info {
    flex: 1;
}

.user-list-item .user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.user-list-item .user-role {
    font-size: 0.75rem;
    color: #999;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .service-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .service-card {
        flex-direction: column;
        text-align: center;
        padding: 14px 10px;
        gap: 8px;
    }

    .service-card-icon {
        width: 40px;
        height: 40px;
    }

    .service-card-icon svg {
        width: 22px;
        height: 22px;
    }

    .service-card-body h3 {
        font-size: 0.85rem;
    }

    .service-card-body p {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .service-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .landing-heading {
        font-size: 2rem;
    }

    .landing-subtitle {
        font-size: 1rem;
    }

    .slide-panel {
        width: 100%;
        min-width: unset;
        max-width: unset;
        right: -100%;
    }

    /* Two-row mobile layout */
    .link-row {
        display: grid;
        grid-template-columns: 28px 1fr auto auto;
        grid-template-rows: auto auto;
        gap: 2px 8px;
        padding: 8px 12px;
        align-items: center;
    }

    /* Row 1: icon | title | badges | code */
    .link-type-icon {
        grid-row: 1 / 3;
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .link-info {
        grid-column: 2;
        grid-row: 1;
    }

    .link-title { font-size: 0.85rem; }
    .link-target { display: none; }

    .link-badges {
        grid-column: 3;
        grid-row: 1;
    }

    .link-code {
        grid-column: 4;
        grid-row: 1;
        font-size: 0.75rem;
        padding: 2px 8px;
    }

    /* Row 2: _ | meta + actions spanning columns 2-4 */
    .link-meta {
        grid-column: 2 / 4;
        grid-row: 2;
        gap: 8px;
        font-size: 0.7rem;
    }

    .link-owner { font-size: 0.7rem; }

    .link-actions {
        grid-column: 4;
        grid-row: 2;
        gap: 2px;
    }

    .link-actions .btn-icon { padding: 3px; }
    .link-actions .btn-icon svg { width: 14px; height: 14px; }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-bar .btn {
        width: 100%;
    }

    .search-group {
        flex-direction: column;
    }

    .dashboard-page {
        padding: 8px 10px;
    }

    .landing-overlay {
        padding: 8px 10px;
    }
}
