/* FlowNex - Components: Bottom Sheet, Buttons, Inputs, Cards, Nav */

/* ===== BOTTOM SHEET ===== */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.sheet-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    z-index: 901;
    transform: translateY(100%);
    transition: transform var(--transition-sheet);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sheet);
}

.bottom-sheet.open {
    transform: translateY(0);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: var(--space-2) auto var(--space-1);
    flex-shrink: 0;
}

.sheet-header {
    padding: var(--space-3) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sheet-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.sheet-close {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.sheet-close:hover {
    background: var(--border);
}

.sheet-close i {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
    -webkit-overflow-scrolling: touch;
}

.sheet-footer {
    padding: var(--space-4) var(--space-5) var(--space-8);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    gap: var(--space-3);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    line-height: 1;
}

.btn i {
    width: 20px;
    height: 20px;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--text-inverse);
    box-shadow: 0 4px 16px var(--accent-shadow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-shadow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background: var(--bg-secondary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--border);
    color: var(--text-primary);
}

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

.btn-row {
    display: flex;
    gap: var(--space-3);
}

.btn-row .btn {
    flex: 1;
}

/* ===== FORM INPUTS ===== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.form-label .required {
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-family: inherit;
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-bg);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px var(--danger-bg);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

select.form-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235f6880' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

textarea.form-input {
    resize: none;
    min-height: 100px;
}

input[type="file"] {
    display: none;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.card-row:hover {
    background: var(--border);
}

.card-row + .card-row {
    margin-top: var(--space-3);
}

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-bottom: var(--space-4);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.upload-area.has-file {
    border-color: var(--success);
    background: var(--success-bg);
}

.upload-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-3);
}

.upload-icon i {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

.upload-area.has-file .upload-icon i {
    color: var(--success);
}

.upload-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.upload-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.upload-filename {
    font-size: var(--font-size-sm);
    color: var(--success);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-2);
}

/* ===== DOC LIST ===== */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.doc-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.doc-item:hover {
    background: var(--border);
}

.doc-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-icon i {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 2px;
}

.doc-size {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.doc-status {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-status i {
    width: 14px;
    height: 14px;
    color: white;
}

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-neutral {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* ===== AVATAR ===== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent-bg);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-xs);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--font-size-lg);
}

/* ===== BOTTOM NAV ===== */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    padding: var(--space-2) var(--space-4) var(--space-6);
    z-index: 800;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2);
    color: var(--text-muted);
    transition: color var(--transition-fast);
    border-radius: var(--radius-md);
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent);
}

.nav-item i {
    width: 22px;
    height: 22px;
}

.nav-item span {
    font-size: 10px;
    font-weight: var(--font-weight-medium);
}

/* ===== CHECKBOX ===== */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    cursor: pointer;
}

.checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.checkbox.checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox i {
    width: 14px;
    height: 14px;
    color: white;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.checkbox.checked i {
    opacity: 1;
}

.checkbox-label {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: var(--line-height-relaxed);
}

/* ===== INFO BOX ===== */
.info-box {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--accent-bg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
}

.info-box i {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* ===== SIGNATURE ===== */
.signature-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.signature-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.signature-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.signature-canvas {
    width: 100%;
    height: 200px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    cursor: crosshair;
    touch-action: none;
}

.signature-hint {
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-2);
}

/* ===== PDF CONTENT ===== */
.pdf-content {
    font-size: var(--font-size-xs);
    line-height: 1.6;
    color: var(--text-primary);
}

.pdf-content .header-company {
    text-align: center;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.pdf-content .header-company h1 {
    font-size: var(--font-size-md);
    margin-bottom: var(--space-1);
}

.pdf-content .header-company p {
    font-size: 10px;
    color: var(--text-secondary);
    margin: 2px 0;
}

.pdf-content .doc-title {
    text-align: center;
    margin: var(--space-5) 0;
}

.pdf-content .doc-title h2 {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-1);
}

.pdf-content .doc-title p {
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-secondary);
}

.pdf-content .article-title {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    margin: var(--space-5) 0 var(--space-3);
    color: var(--text-primary);
}

.pdf-content .section-title {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    text-align: center;
    margin: var(--space-6) 0 var(--space-4);
    color: var(--accent);
}

.pdf-content p {
    margin-bottom: var(--space-2);
    text-align: justify;
}

.pdf-content .variable {
    font-weight: var(--font-weight-bold);
    color: var(--accent-dark);
    background: var(--accent-bg);
    padding: 1px 4px;
    border-radius: 3px;
}

.pdf-content ul {
    margin: var(--space-2) 0 var(--space-2) var(--space-5);
}

.pdf-content li {
    margin-bottom: var(--space-1);
}

.pdf-content .parties-section {
    background: var(--bg-secondary);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin: var(--space-4) 0;
}

.pdf-content .parties-section h3 {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-3);
}

/* ===== PDF TABS ===== */
.pdf-tabs {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.pdf-tab {
    flex: 1;
    padding: var(--space-3);
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    text-align: center;
}

.pdf-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ===== DIVIDER ===== */
.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-6) 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-5);
}

.empty-state i {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin: 0 auto var(--space-4);
}

.empty-state h3 {
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--font-size-sm);
    max-width: 300px;
    margin: 0 auto;
}
