:root {
    --bg-app: #f8f9fb;
    --bg-white: #ffffff;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

h1,
h2,
.logo-text {
    font-family: 'Outfit', sans-serif;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Navigation */
.top-nav {
    height: 64px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.2rem;
}

.logo-text {
    font-weight: 600;
    font-size: 1.1rem;
}

.logo-text span {
    color: var(--primary);
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.project-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.project-breadcrumb .root {
    color: var(--text-muted);
}

.breadcrumb-sep {
    width: 14px;
    height: 14px;
    color: var(--border);
}

.project-title {
    font-size: 1rem;
    font-weight: 600;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-app);
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Toolbar */
.toolbar {
    width: 64px;
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 24px;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--bg-app);
    color: var(--text-main);
}

.tool-btn.active {
    background: var(--primary);
    color: white;
}

.tool-btn svg {
    width: 20px;
    height: 20px;
}

/* Page Sidebar */
.page-sidebar {
    width: 180px;
    background: #f1f5f9;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header-sm {
    padding: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-icon {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.page-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.page-list::-webkit-scrollbar {
    width: 4px;
}

.page-list::-webkit-scrollbar-track {
    background: transparent;
}

.page-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.page-item {
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-item:hover {
    background: #e2e8f0;
}

.page-item.active {
    background: white;
    box-shadow: var(--shadow-sm);
}

.page-thumb {
    width: 100%;
    aspect-ratio: 1/1.2;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid var(--border);
}

.page-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
}

.page-name {
    font-size: 0.75rem;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ededed;
    overflow: auto;
    padding: 40px;
}

/* Fabric.js specific wrapper overrides */
.canvas-container {
    box-shadow: var(--shadow-lg) !important;
    background: white;
    margin: 0 auto;
}

#reviewCanvas {
    max-width: 100%;
    height: auto;
}

/* Marker Styles */
.comment-marker {
    position: absolute;
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: white;
    border-radius: 50% 50% 0 50%;
    transform: translate(-15px, -30px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
}

.comment-marker:hover {
    transform: translate(-15px, -30px) scale(1.1);
}

/* Sidebar */
.comments-sidebar {
    width: 360px;
    background: var(--bg-white);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header .count {
    background: var(--bg-app);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.filter-controls {
    display: flex;
    gap: 8px;
}

.filter-controls button {
    background: none;
    border: none;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 0;
}

.filter-controls button.active {
    color: var(--primary);
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
}

.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.comment-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.avatar {
    width: 32px;
    height: 32px;
    background: #fecaca;
    color: #991b1b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.avatar-blue {
    background: #bfdbfe;
    color: #1e40af;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-info .name {
    font-size: 0.875rem;
    font-weight: 600;
}

.author-info .time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-main);
}

.comment-actions {
    margin-top: 12px;
    display: flex;
    gap: 16px;
}

.btn-text {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
}

.btn-text:hover {
    color: var(--primary);
}

.comment-input-container {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

#newCommentInput {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

#newCommentInput:focus {
    border-color: var(--primary);
}

.btn-send {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-send:hover {
    transform: scale(1.05);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: #fafafa;
}

/* Form Styles */
.copy-input {
    display: flex;
    gap: 8px;
}

.copy-input input {
    flex: 1;
    background: #f1f5f9;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    cursor: pointer;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input[type="password"],
.form-group input[type="text"],
.form-group input[type="email"],
.form-group select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 100%;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="color"] {
    height: 40px;
    cursor: pointer;
    background: none;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.icon-sm {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
}

/* Member List */
.member-invite {
    display: flex;
    gap: 8px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.member-invite input {
    flex: 2;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.member-invite select {
    flex: 1;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.member-info .name {
    font-size: 0.9rem;
    font-weight: 500;
}

.member-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.role-select {
    border: none;
    background: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}

.text-danger {
    color: #ef4444;
}

.btn-icon-text {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.comment-card.resolved {
    opacity: 0.6;
    background: #f9fafb;
}

.comment-card.resolved .comment-text {
    text-decoration: line-through;
}

/* Asset Item Delete */
.page-item {
    position: relative;
}

.btn-delete-asset {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #ef4444;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.page-item:hover .btn-delete-asset {
    display: flex;
}

.btn-delete-asset i {
    width: 14px;
    height: 14px;
}

.loading-state {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.btn-icon-sm:hover {
    color: var(--primary);
}

/* Page Check UI */
.btn-check-page {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: #f3f4f6;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-check-page:hover {
    background: #e5e7eb;
}

.btn-check-page.checked {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.btn-check-page i {
    width: 14px;
    height: 14px;
}

.page-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.page-item:hover {
    background: #f3f4f6;
}

.page-item.active {
    background: #eff6ff;
    border-color: var(--primary);
}

.page-check-status {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

.page-check-status i {
    width: 12px;
    height: 12px;
}