:root {
    --primary-blue: #6B9BD1;
    --primary-blue-dark: #5A87B8;
    --accent-coral: #FF6B6B;
    --accent-coral-hover: #E85A5A;
    --bg-warm: #FDFBF7;
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(255, 255, 255, 0.5);
    --text-main: #2D3436;
    --text-muted: #636E72;
    --window-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --ginger-cream: #F5E6D3;
    --ginger-orange: #D4A574;
    --window-border-radius: 12px;
}

/* PIN Gate */
.pin-gate {
    position: fixed;
    inset: 0;
    background: var(--bg-warm);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pin-gate.hidden { display: none; }
.pin-container {
    text-align: center;
    padding: 3rem 4rem;
    max-width: 360px;
}
.pin-cat {
    width: 80px;
    mix-blend-mode: multiply;
    margin-bottom: 1.5rem;
}
.pin-container h2 {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 0.25rem;
}
.pin-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.pin-input {
    width: 100%;
    padding: 14px;
    font-size: 2rem;
    text-align: center;
    letter-spacing: 0.5em;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    background: white;
    outline: none;
    font-family: 'Inter', monospace;
    transition: border-color 0.2s;
}
.pin-input:focus {
    border-color: var(--primary-blue);
}
.pin-input.shake {
    animation: shake 0.4s ease;
    border-color: var(--accent-coral);
}
.pin-error {
    color: var(--accent-coral);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    font-weight: 600;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-warm);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    box-shadow: var(--window-shadow);
    border-radius: var(--window-border-radius);
    position: relative;
    overflow: hidden;
}

/* macOS Window Chrome */
.window-chrome {
    height: 40px;
    background: rgba(230, 230, 230, 0.5);
    border-top-left-radius: var(--window-border-radius);
    border-top-right-radius: var(--window-border-radius);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chrome-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red {
    background: #FF5F57;
}

.dot-yellow {
    background: #FFBD2E;
}

.dot-green {
    background: #28C940;
}

.window-title {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-right: 48px;
    /* Offset for symmetry with dots */
}

/* Layout */
header {
    padding: 2rem;
    text-align: center;
}

.logo-container {
    margin-bottom: 1rem;
}

.logo-container img {
    height: 48px;
}

main {
    flex: 1;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Queue View */
.view-queue {
    max-width: 900px;
    margin: 0 auto;
}

.view-queue .glass-panel {
    padding-left: 80px !important;
    padding-right: 80px !important;
}

.queue-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.queue-list {
    margin-top: 1rem;
}

.queue-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.queue-item:last-child {
    border-bottom: none;
}

.queue-item:hover {
    background: rgba(107, 155, 209, 0.08);
    transform: translateX(5px);
}

.queue-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.queue-item-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-draft {
    background: #E9ECEF;
    color: #495057;
}

.status-ready {
    background: #D1E7DD;
    color: #0F5132;
}

.status-published {
    background: #CFE2FF;
    color: #084298;
}

/* Workspace View */
.workspace-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: 70vh;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-blue) transparent;
}

textarea {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1.05rem;
    resize: none;
    outline: none;
    color: var(--text-main);
    line-height: 1.6;
}

.reference-text {
    font-size: 1.05rem;
    color: var(--text-main);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Cat Elements */
.corner-cat {
    position: absolute;
    bottom: 10px;
    right: 10px;
    pointer-events: none;
    width: 60px;
    /* Smaller - inside the container */
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    mix-blend-mode: multiply;
    /* Transparent background effect */
    opacity: 0.9;
}

.cat-left {
    left: 10px;
    right: auto;
}

.cat-top {
    top: 10px;
    bottom: auto;
}

.cat-top-right {
    top: 10px;
    right: 10px;
    bottom: auto;
}

.cat-peek {
    transform: scale(0.9);
}

.cat-peek:hover {
    transform: scale(1.1) rotate(5deg);
}

.cat-tail-flick {
    animation: tail-flick 6s infinite alternate ease-in-out;
}

@keyframes tail-flick {
    0% {
        transform: rotate(0deg);
    }

    10% {
        transform: rotate(8deg);
    }

    20% {
        transform: rotate(-8deg);
    }

    30% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

/* Footer Cat Walking Animation */
.footer-cats {
    position: relative;
    height: 80px;
    overflow: hidden;
    margin-top: 2rem;
}

.walking-cat {
    position: absolute;
    bottom: 0;
    width: 60px;
    mix-blend-mode: multiply;
    animation: walk-across 20s linear infinite;
}

.walking-cat:nth-child(2) {
    animation-delay: -7s;
    transform: scaleX(-1);
}

.walking-cat:nth-child(3) {
    animation-delay: -14s;
}

@keyframes walk-across {
    0% {
        left: -60px;
        transform: scaleX(1);
    }

    49% {
        left: calc(100% + 10px);
        transform: scaleX(1);
    }

    50% {
        left: calc(100% + 10px);
        transform: scaleX(-1);
    }

    99% {
        left: -60px;
        transform: scaleX(-1);
    }

    100% {
        left: -60px;
        transform: scaleX(1);
    }
}

.dancing-cat {
    position: absolute;
    bottom: 0;
    width: 45px;
    mix-blend-mode: multiply;
    animation: dance 1.5s ease-in-out infinite;
}

@keyframes dance {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-10px) rotate(-5deg);
    }

    50% {
        transform: translateY(0) rotate(0deg);
    }

    75% {
        transform: translateY(-8px) rotate(5deg);
    }
}

/* Actions Bar */
.action-bar {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
}

.stats-container {
    display: flex;
    gap: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-item b {
    color: var(--text-main);
}

.btn-group {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 12px 28px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(107, 155, 209, 0.3);
}

.btn-primary:hover {
    background: var(--primary-blue-dark);
    box-shadow: 0 6px 16px rgba(107, 155, 209, 0.4);
}

.btn-accent {
    background: var(--accent-coral);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.btn-accent:hover {
    background: var(--accent-coral-hover);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: #E9ECEF;
    color: var(--text-main);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .workspace-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Header Actions */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 2rem;
}

.header-actions {
    position: absolute;
    right: 2rem;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    position: relative;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

.badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent-coral);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--bg-warm);
    pointer-events: none;
}

/* Inbox Panel */
.inbox-panel {
    position: fixed;
    top: 6rem;
    right: 2rem;
    width: 350px;
    max-height: 500px;
    z-index: 1000;
    display: none;
    /* Controlled by JS */
    flex-direction: column;
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inbox-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inbox-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.inbox-messages {
    overflow-y: auto;
    padding: 0.5rem;
    max-height: 400px;
}

.inbox-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.inbox-message:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

.inbox-message.unread {
    background: rgba(107, 155, 209, 0.05);
}

.inbox-message .msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.inbox-message .from {
    font-weight: 700;
    font-size: 0.85rem;
}

.inbox-message .via {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
}

.inbox-message .content {
    font-size: 0.9rem;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.inbox-message .time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: right;
}